code: def _partition(s, sep, find):
      
      idx = find(sep)
      if idx != -1:
          left = s[0:idx]
          return left, sep, s[len(left)+len(sep):]
docs: (str|unicode).(partition|rpartition) for Python 2.4/2.5.