def compare_sub(got, expected):
    """ Check if got subdomain of expected, throw exception if different. """
    if not expected.is_subdomain(got):
        raise Exception("expected subdomain of '%s', got '%s'" % (expected, got))
    return True