code: def _check_file(self, filename):
      
      # If the user specifies an invalid severity use comment.
      log_threshold = Nit.SEVERITY.get(self._severity, Nit.COMMENT)
  
      failure_count = 0
      fail_threshold = Nit.WARNING if self._strict else Nit.ERROR
  
      for i, nit in enumerate(self._get_nits(filename)):
        if i == 0:
          print()  # Add an extra newline to clean up the output only if we have nits.
        if nit.severity >= log_threshold:
          print('{nit}\n'.format(nit=nit))
        if nit.severity >= fail_threshold:
          failure_count += 1
      return failure_count
docs: Process python file looking for indications of problems.
  
      :param filename: (str) Python source filename
      :return: (int) number of failures