Function canonicalizeSubject