New in Python 2.5 as str.partition(sep)

def partition(string, sep):
    """
    New in Python 2.5 as str.partition(sep)
    """
    p = string.split(sep, 1)
    if len(p) == 2:
        return p[0], sep, p[1]
    return string, '', ''