docs: def lint_command(name, program, arguments, filter_regex, filename, lines):
      """Executes a lint program and filter the output.
  
      Executes the lint tool 'program' with arguments 'arguments' over the file
      'filename' returning only those lines matching the regular expression
      'filter_regex'.
  
      Args:
        name: string: the name of the linter.
        program: string: lint program.
        arguments: list[string]: extra arguments for the program.
        filter_regex: string: regular expression to filter lines.
        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.
  
      Returns: dict: a dict with the extracted info from the message.
      """
      output = utils.get_output_from_cache(name, filename)
  
      if output is None:
          call_arguments = [program] + arguments + [filename]
          try:
              output = subprocess.check_output(
                  call_arguments, stderr=subprocess.STDOUT)
          except subprocess.CalledProcessError as error:
              output = error.output
          except OSError:
              return {
                  filename: {
                      'error': [('Could not execute "%s".%sMake sure all ' +
                                 'required programs are installed') %
                                (' '.join(call_arguments), os.linesep)]
                  }
              }
          output = output.decode('utf-8')
          utils.save_output_in_cache(name, filename, output)
  
      output_lines = output.split(os.linesep)
  
      if lines is None:
          lines_regex = r'\d+'
      else:
          lines_regex = '|'.join(map(str, lines))
      lines_regex = '(%s)' % lines_regex
  
      groups = ('line', 'column', 'message', 'severity', 'message_id')
      filtered_lines = utils.filter_lines(
          output_lines,
          filter_regex.format(lines=lines_regex, filename=re.escape(filename)),
          groups=groups)
  
      result = []
      for data in filtered_lines:
          comment = dict(p for p in zip(groups, data) if p[1] is not None)
          if 'line' in comment:
              comment['line'] = int(comment['line'])
          if 'column' in comment:
              comment['column'] = int(comment['column'])
          if 'severity' in comment:
              comment['severity'] = comment['severity'].title()
          result.append(comment)
  
      return {filename: {'comments': result}}