code: def find_filetype(fpath):
      mimetype = magic.from_file(fpath).lower()
  
      # Get extensions from mimetype
      # The mimetype is not always consistent, so use in to check the most common formats
      if "pdf" in mimetype:
          return "pdf"
      elif "epub" in mimetype:
          return "epub"
      elif "mobi" in mimetype:
          return "mobi"
      elif mimetype in settings.SUPPORTED_FILETYPES:
          return settings.SUPPORTED_FILETYPES[mimetype]
      else:
          print(f"Found nonstandard filetype {mimetype}")
          return "other"
  
imports: import fitz
  from marker.cleaners.table import merge_table_blocks, create_new_tables
  from marker.debug.data import dump_bbox_debug_data
  from marker.extract_text import get_text_blocks
  from marker.cleaners.headers import filter_header_footer, filter_common_titles
  from marker.cleaners.equations import replace_equations
  from marker.ordering import order_blocks
  from marker.postprocessors.editor import edit_full_text
  from marker.segmentation import detect_document_block_types
  from marker.cleaners.code import identify_code_blocks, indent_blocks
  from marker.cleaners.bullets import replace_bullets
  from marker.markdown import merge_spans, merge_lines, get_full_text
  from marker.schema import Page, BlockType
  from typing import List, Dict, Tuple, Optional
  import re
  import magic
  from marker.settings import settings
label_desc: Use image node_id 1 for calling a global function with example usage: find_filetype(fpath) and returns: str, str, str, settings, str