docs: def read_file(filename, print_error=True):
      """Returns the contents of a file."""
      try:
          for encoding in ['utf-8', 'latin1']:
              try:
                  with io.open(filename, encoding=encoding) as fp:
                      return fp.read()
              except UnicodeDecodeError:
                  pass
      except IOError as exception:
          if print_error:
              print(exception, file=sys.stderr)
          return None