docs: def lint(filename, lines, config):
      """Lints a file.
  
      Args:
          filename: string: filename to lint.
          lines: list[int]|None: list of lines that we want to capture. If None,
            then all lines will be captured.
          config: dict[string: linter]: mapping from extension to a linter
            function.
  
      Returns: dict: if there were errors running the command then the field
        'error' will have the reasons in a list. if the lint process was skipped,
        then a field 'skipped' will be set with the reasons. Otherwise, the field
        'comments' will have the messages.
      """
      _, ext = os.path.splitext(filename)
      if ext in config:
          output = collections.defaultdict(list)
          for linter in config[ext]:
              linter_output = linter(filename, lines)
              for category, values in linter_output[filename].items():
                  output[category].extend(values)
  
          if 'comments' in output:
              output['comments'] = sorted(
                  output['comments'],
                  key=lambda x: (x.get('line', -1), x.get('column', -1)))
  
          return {filename: dict(output)}
      else:
          return {
              filename: {
                  'skipped': [
                      'no linter is defined or enabled for files'
                      ' with extension "%s"' % ext
                  ]
              }
          }