Determines whether the passed value is a method satisfying certain conditions:
      * Being instance method.
      * Being class method.
      * Being bound method.
      * Being unbound method.
    Flag check is considered or-wise. The default is to consider every option.
    :param method:
    :param flags:
    :return:

def is_method(method, flags=METHOD_ALL):
    """
    Determines whether the passed value is a method satisfying certain conditions:
      * Being instance method.
      * Being class method.
      * Being bound method.
      * Being unbound method.
    Flag check is considered or-wise. The default is to consider every option.
    :param method:
    :param flags:
    :return:
    """
    if isinstance(method, types.UnboundMethodType):
        if flags & METHOD_CLASS and issubclass(method.im_class, type):
            return True
        if flags & METHOD_INSTANCE and not issubclass(method.im_class, type):
            return True
        if flags & METHOD_BOUND and method.im_self is not None:
            return True
        if flags & METHOD_UNBOUND and method.im_self is None:
            return True
    return False