Checks if a given `function` complies with this specification. If an
        inconsistency is detected a :py:exc:`MethodValidationError` exception
        is raised.

        .. note::
            This method will not work as expected when `function` is an unbound
            method (``SomeClass.some_method``), as in Python 3 there is no way
            to recognize that this is in fact a method. Therefore, the implied
            `self` argument will not be ignored.

        :raises:
            :py:exc:`MethodValidationError`

def check_compliance(self, function):
        """
        Checks if a given `function` complies with this specification. If an
        inconsistency is detected a :py:exc:`MethodValidationError` exception
        is raised.

        .. note::
            This method will not work as expected when `function` is an unbound
            method (``SomeClass.some_method``), as in Python 3 there is no way
            to recognize that this is in fact a method. Therefore, the implied
            `self` argument will not be ignored.

        :raises:
            :py:exc:`MethodValidationError`
        """
        argument_specification = _get_argument_specification(function)
        if inspect.ismethod(function):
            # Remove implied `self` argument from specification if function is
            # a method.
            argument_specification = argument_specification._replace(
                args=argument_specification.args[1:]
            )
        if argument_specification != self.argument_specification:
            raise MethodValidationError(
                function,
                self.argument_specification,
                argument_specification
            )