'If self is a subdomain of origin, return a new name which is self
relative to origin.  Otherwise return self.
@rtype: dns.name.Name object'

def relativize(self, origin):

    if ((not (origin is None)) and self.is_subdomain(origin)):
        return Name(self[:(- len(origin))])
    else:
        return self
