code: def read_py_file(filename, skip_encoding_cookie=True):
      """Read a Python file, using the encoding declared inside the file.
  
      Parameters
      ----------
      filename : str
        The path to the file to read.
      skip_encoding_cookie : bool
        If True (the default), and the encoding declaration is found in the first
        two lines, that line will be excluded from the output - compiling a
        unicode string with an encoding declaration is a SyntaxError in Python 2.
  
      Returns
      -------
      A unicode string containing the contents of the file.
      """
      with open(
          filename
      ) as f:  # the open function defined in this module.
          if skip_encoding_cookie:
              return "".join(strip_encoding_cookie(f))
          else:
              return f.read()
  
file_path: catboost/contrib/python/ipython/py2/IPython/utils/openpy.py
imports: from __future__ import absolute_import
  import io
  from io import TextIOWrapper, BytesIO
  import os.path
  import re
  from .py3compat import unicode_type
label_desc: Use image node_id 3 for calling a global function with example usage: read_py_file(filename, skip_encoding_cookie) and returns: str, f