def is_related_to_user(object_instance, user, field):
    """Return True when the object_instance is related to user."""
    user_instance = getattr(object_instance, field, None)
    if user:
        if user_instance == user:
            return True
    return False