code: def dirname(p):
      """Returns the directory component of a pathname"""
      p = os.fspath(p)
      sep = _get_sep(p)
      i = p.rfind(sep) + 1
      head = p[:i]
      if head and head != sep * len(head):
          head = head.rstrip(sep)
      return head
  
imports: import os
  import sys
  import stat
  import genericpath
  from genericpath import *
label_desc: Use image node_id 9 for calling a global function with example usage: dirname(p) and returns: head