import inspect


def for_own_methods(method_decorator):
    """ Decorates all the methods in a class.

    This function takes a function decorator and returns a class
    decorator that applies the function decorator to all of the
    methods in a class. The function decorator will only be applied
    to methods that are explicitly defined on the class. Any inherited
    methods that aren't overridden or altered will not be decorated.

    Args:
        method_decorator (function): Method decorator to be applied to
            each method of the class

    Returns:
        function: A class decorator
    """

    def decorate(cls):
        def predicate(member):
            return inspect.ismethod(member) and member.__name__ in cls.__dict__

        for name, method in inspect.getmembers(cls, predicate):
            setattr(cls, name, method_decorator(method))
        return cls

    return decorate