':param form_matcher: A FormIDMatcher instance as configured by the user
:return: True if the other form matches self according to the rules
defined in https://github.com/andresriancho/w3af/issues/15161'

def matches(self, form_matcher):

    if (form_matcher.inputs is not None):
        for input_name in form_matcher.inputs:
            if (input_name not in self.inputs):
                return False
    if (form_matcher.attributes is not None):
        self_attribute_values = self.attributes.items()
        for (attribute, attribute_value) in form_matcher.attributes.iteritems():
            if ((attribute, attribute_value) not in self_attribute_values):
                return False
    if ((form_matcher.method is not None) and (self.method is not None)):
        if (form_matcher.method.lower() != self.method.lower()):
            return False
    if (form_matcher.action is not None):
        action_url_path = self.action.get_path()
        if (not form_matcher.action.match(action_url_path)):
            return False
    if (form_matcher.hosted_at_url is not None):
        hosted_at_url_path = self.hosted_at_url.get_path()
        if (not form_matcher.hosted_at_url.match(hosted_at_url_path)):
            return False
    return True
