code: def open(
      path: str,
      mode: str = "r",
      buffer_size: int = 8192,
      *,
      requester_pays_config: Optional[
          GCSRequesterPaysConfiguration
      ] = None,
  ) -> io.IOBase:
      """Open a file from the local filesystem of from blob storage. Supported
      blob storage providers are GCS, S3 and ABS.
  
      Examples
      --------
      Write a Pandas DataFrame as a CSV directly into Google Cloud Storage:
  
      >>> with hfs.open('gs://my-bucket/df.csv', 'w') as f: # doctest: +SKIP
      ...     pandas_df.to_csv(f)
  
      Read and print the lines of a text file stored in Google Cloud Storage:
  
      >>> with hfs.open('gs://my-bucket/notes.txt') as f: # doctest: +SKIP
      ...     for line in f:
      ...         print(line.strip())
  
      Access a text file stored in a Requester Pays Bucket in Google Cloud Storage:
  
      >>> with hfs.open( # doctest: +SKIP
      ...     'gs://my-bucket/notes.txt',
      ...     requester_pays_config='my-project'
      ... ) as f:
      ...     for line in f:
      ...         print(line.strip())
  
      Specify multiple Requester Pays Buckets within a project that are acceptable
      to access:
  
      >>> with hfs.open( # doctest: +SKIP
      ...     'gs://my-bucket/notes.txt',
      ...     requester_pays_config=('my-project', ['my-bucket', 'bucket-2'])
      ... ) as f:
      ...     for line in f:
      ...         print(line.strip())
  
      Write two lines directly to a file in Google Cloud Storage:
  
      >>> with hfs.open('gs://my-bucket/notes.txt', 'w') as f: # doctest: +SKIP
      ...     f.write('result1: %s\\n' % result1)
      ...     f.write('result2: %s\\n' % result2)
  
      Unpack a packed Python struct directly from a file in Google Cloud Storage:
  
      >>> from struct import unpack
      >>> with hfs.open('gs://my-bucket/notes.txt', 'rb') as f: # doctest: +SKIP
      ...     print(unpack('<f', bytearray(f.read())))
  
      Notes
      -----
      The supported modes are:
  
       - ``'r'`` -- Readable text file (:class:`io.TextIOWrapper`). Default behavior.
       - ``'w'`` -- Writable text file (:class:`io.TextIOWrapper`).
       - ``'x'`` -- Exclusive writable text file (:class:`io.TextIOWrapper`).
         Throws an error if a file already exists at the path.
       - ``'rb'`` -- Readable binary file (:class:`io.BufferedReader`).
       - ``'wb'`` -- Writable binary file (:class:`io.BufferedWriter`).
       - ``'xb'`` -- Exclusive writable binary file (:class:`io.BufferedWriter`).
         Throws an error if a file already exists at the path.
  
      The provided destination file path must be a URI (uniform resource identifier)
      or a path on the local filesystem.
  
      Parameters
      ----------
      path : :class:`str`
          Path to file.
      mode : :class:`str`
          File access mode.
      buffer_size : :obj:`int`
          Buffer size, in bytes.
  
      Returns
      -------
          Readable or writable file handle.
      """
      return _fses[requester_pays_config].open(path, mode, buffer_size)
  
file_path: hail/hail/python/hailtop/fs/fs_utils.py
imports: import io
  from typing import List, Optional
  from hailtop.aiocloud.aiogoogle import GCSRequesterPaysConfiguration
  from hailtop.utils.gcs_requester_pays import GCSRequesterPaysFSCache
  from .router_fs import RouterFS
  from .stat_result import FileListEntry
label_desc: Use image node_id 1 for calling a global function with example usage: open(path, mode, buffer_size) and returns: _fses