code: def is_file(path: str) -> bool:
      """
  
      Check if a path is file or not. It supports local, hdfs, s3 file systems.
  
      :param path: path string.
      :return: if path is a file.
      """
      if path.startswith("s3"):  # s3://bucket/file_path
          access_key_id = os.environ["AWS_ACCESS_KEY_ID"]
          secret_access_key = os.environ["AWS_SECRET_ACCESS_KEY"]
          import boto3
  
          s3_client = boto3.Session(
              aws_access_key_id=access_key_id,
              aws_secret_access_key=secret_access_key,
          ).client("s3")
          path_parts = path.split("://")[1].split("/")
          bucket = path_parts.pop(0)
          key = "/".join(path_parts)
          try:
              dir_key = key + "/"
              resp1 = s3_client.list_objects(
                  Bucket=bucket, Prefix=key, Delimiter="/", MaxKeys=1
              )
              if "Contents" in resp1:
                  resp2 = s3_client.list_objects(
                      Bucket=bucket,
                      Prefix=dir_key,
                      Delimiter="/",
                      MaxKeys=1,
                  )
                  return not ("Contents" in resp2)
              else:
                  return False
          except Exception as ex:
              invalidOperationError(False, str(ex), cause=ex)
              return False
      elif path.startswith("hdfs://"):
          return file_utils.is_file(path)
      else:
          if path.startswith("file://"):
              path = path[len("file://") :]
          from pathlib import Path
  
          return Path(path).is_file()
  
imports: import os
  import subprocess
  import logging
  import shutil
  import functools
  import glob
  from distutils.dir_util import copy_tree
  from bigdl.dllib.utils.log4Error import invalidOperationError
  from bigdl.dllib.utils import file_utils
  from typing import TYPE_CHECKING, List, Callable, Union, Optional
label_desc: Use image node_id 9 for calling a global function with example usage: is_file(path) and returns: file_utils, Path, unknown, False, False