import inspect


def _is_user_defined_lint(mod_name):
  """Return a function that tests if a module member is a user-defined lint.

  Args:
    mod_name: THe string name of the module file containing the lint.

  Returns:
    Function: This returns a Boolean: True if the module member is a lint.
  """

  def is_lint(member):
    return (inspect.isfunction(member) and member.__module__ == mod_name and
            hasattr(member, "_lint"))

  return is_lint