def is_commentable(obj_or_class):
    """
    :param obj_or_class: a class or instance
    """
    if isinstance(obj_or_class, type):
        return issubclass(obj_or_class, Commentable)

    if not isinstance(obj_or_class, Commentable):
        return False

    if obj_or_class.id is None:
        return False

    return True
def is_commentable ( obj_or_class ) : if isinstance ( obj_or_class , type ) : return issubclass ( obj_or_class , Commentable ) if not isinstance ( obj_or_class , Commentable ) : return False if obj_or_class . id is None : return False return True
:param obj_or_class: a class or instance