code: def write(
      self,
      df: DataFrame,
      path,
      compression: Literal["snappy", "gzip", "brotli"]
      | None = "snappy",
      index=None,
      partition_cols=None,
      storage_options: StorageOptions = None,
      **kwargs,
  ) -> None:
      self.validate_dataframe(df)
  
      if "partition_on" in kwargs and partition_cols is not None:
          raise ValueError(
              "Cannot use both partition_on and "
              "partition_cols. Use partition_cols for partitioning data"
          )
      if "partition_on" in kwargs:
          partition_cols = kwargs.pop("partition_on")
  
      if partition_cols is not None:
          kwargs["file_scheme"] = "hive"
  
      # cannot use get_handle as write() does not accept file buffers
      path = stringify_path(path)
      if is_fsspec_url(path):
          fsspec = import_optional_dependency("fsspec")
  
          # if filesystem is provided by fsspec, file must be opened in 'wb' mode.
          kwargs["open_with"] = lambda path, _: fsspec.open(
              path, "wb", **(storage_options or {})
          ).open()
      elif storage_options:
          raise ValueError(
              "storage_options passed with file object or non-fsspec file path"
          )
  
      with catch_warnings(record=True):
          self.api.write(
              path,
              df,
              compression=compression,
              write_index=index,
              partition_on=partition_cols,
              **kwargs,
          )
  
imports: from __future__ import annotations
  import io
  import os
  from typing import Any, Literal
  import warnings
  from warnings import catch_warnings
  from pandas._libs import lib
  from pandas._typing import DtypeBackend, FilePath, ReadBuffer, StorageOptions, WriteBuffer
  from pandas.compat._optional import import_optional_dependency
  from pandas.errors import AbstractMethodError
  from pandas.util._decorators import doc
  from pandas.util._exceptions import find_stack_level
  from pandas.util._validators import check_dtype_backend
  import pandas
  from pandas import DataFrame, get_option
  from pandas.core.shared_docs import _shared_docs
  from pandas.util.version import Version
  from pandas.io.common import IOHandles, get_handle, is_fsspec_url, is_url, stringify_path
label_desc: Use image node_id 2 for calling the FastParquetImpl obj's underlying member method code with example usage: obj.write(df, path, compression, index, partition_cols, storage_options) without return types