code: def _guess_mime_type(file_path):
      filename = pathlib.Path(file_path).name
      extension = os.path.splitext(filename)[-1].replace(".", "")
      # for MLmodel/mlproject with no extensions
      if extension == "":
          extension = filename
      if extension in get_text_extensions():
          return "text/plain"
      mime_type, _ = guess_type(filename)
      if not mime_type:
          # As a fallback, if mime type is not detected, treat it as a binary file
          return "application/octet-stream"
      return mime_type
  
imports: import os
  import pathlib
  from mimetypes import guess_type
label_desc: Use image node_id 2 for calling a global function with example usage: _guess_mime_type(file_path) and returns: mime_type, str, str