import inspect


def get_method_description(method):
    """
    Retrieves a description of the given method. If possible, the description
    contains the source file name and line.

    :param method: A method
    :return: A description of the method (at least its name)
    """
    try:
        try:
            line_no = inspect.getsourcelines(method)[1]

        except IOError:
            # Error reading the source file
            line_no = -1

        return "'{method}' ({file}:{line})" \
            .format(method=method.__name__,
                    file=inspect.getfile(method),
                    line=line_no)

    except TypeError:
        # Method can't be inspected
        return "'{0}'".format(method.__name__)