'Parse a single attribute type and value pair from one or
more lines of LDIF data'

def _parseAttrTypeandValue(self):

    unfolded_line = self._unfoldLDIFLine()
    while (unfolded_line and (unfolded_line[0] == '#')):
        unfolded_line = self._unfoldLDIFLine()
    if ((not unfolded_line) or (unfolded_line == '\n') or (unfolded_line == '\r\n')):
        return (None, None)
    try:
        colon_pos = unfolded_line.index(':')
    except ValueError:
        return (None, None)
    attr_type = unfolded_line[0:colon_pos]
    value_spec = unfolded_line[colon_pos:(colon_pos + 2)]
    if (value_spec == '::'):
        attr_value = base64.decodestring(unfolded_line[(colon_pos + 2):])
    elif (value_spec == ':<'):
        url = unfolded_line[(colon_pos + 2):].strip()
        attr_value = None
        if self._process_url_schemes:
            u = urlparse.urlparse(url)
            if self._process_url_schemes.has_key(u[0]):
                attr_value = urllib.urlopen(url).read()
    elif ((value_spec == ':\r\n') or (value_spec == '\n')):
        attr_value = ''
    else:
        attr_value = unfolded_line[(colon_pos + 2):].lstrip()
    return (attr_type, attr_value)
