code: def _partition(str_arg, sep):
      
      try:
          return str_arg.partition(sep)
      except AttributeError:
          try:
              idx = str_arg.index(sep)
          except ValueError:
              return (str_arg, '', '')
          return (str_arg[:idx], sep, str_arg[idx + len(sep):])
docs: _partition(str_arg, sep) -> (head, sep, tail)
  
      Searches for the first occurrence of the separator sep in str_arg, and
      returns the, part before it, the separator itself, and the part after it.
  
      If the separator is not found, returns str_arg and two empty strings.