def identifyKeyValue(string):
    """
    identify key-end and value-start position
    from data start immediately with the key.

    the data should not have leading whitespace
    since whitespace will be read as seperator,
    then the key will be empty.

    @example
    identifyKeyValue('key=value') -> 3, 4
    identifyKeyValue('key = value') -> 3, 6
    """
    limit = len(string)
    keyEnd = 0
    valueStart = limit
    hasSep = False
    precedingBackslash = False
    while keyEnd < limit:
        c = string[keyEnd]
        if (c == '=' or c == ':') and not precedingBackslash:
            valueStart = keyEnd + 1
            hasSep = True
            break
        elif (c == ' ' or c == '\t' or c == '\x0c') and not precedingBackslash:
            valueStart = keyEnd + 1
            break
        if c == '\\':
            precedingBackslash = not precedingBackslash
        else:
            precedingBackslash = False
        keyEnd += 1
    while valueStart < limit:
        c = string[valueStart]
        if c != ' ' and c != '\t' and c != '\x0c':
            if not hasSep and (c == '=' or c == ':'):
                hasSep = True
            else:
                break
        valueStart += 1
    return keyEnd, valueStart
