def parse_headers(obj):
    """Parse a string a iterable object (including file like objects) to a
    python dictionary.

    Args:
        obj: An iterable object including file-like objects.

    Returns:
        An dictionary of headers. If a header is repeated then the last value
        for that header is given.

    Raises:
        ValueError: If the first line is a continuation line or the headers
            cannot be parsed.
    """
    if isinstance(obj, basestring):
        obj = cStringIO.StringIO(obj)
    hdrs = []
    for line in obj:
        hdr = parse_header(line)
        if not hdr:
            break
        if isinstance(hdr, basestring):
            if not hdrs:
                raise ValueError("First header is a continuation")
            hdrs[-1] = (hdrs[-1][0], hdrs[-1][1] + hdr)
            continue
        hdrs.append(hdr)
    return iodict.IODict(hdrs)
def parse_headers(obj):
    """Parse a string a iterable object (including file like objects) to a
    python dictionary.

    Args:
        obj: An iterable object including file-like objects.

    Returns:
        An dictionary of headers. If a header is repeated then the last value
        for that header is given.

    Raises:
        ValueError: If the first line is a continuation line or the headers
            cannot be parsed.
    """
    if isinstance(obj, basestring):
        obj = cStringIO.StringIO(obj)
    hdrs = []
    for line in obj:
        hdr = parse_header(line)
        if not hdr:
            break
        if isinstance(hdr, basestring):
            if not hdrs:
                raise ValueError("First header is a continuation")
            hdrs[-1] = (hdrs[-1][0], hdrs[-1][1] + hdr)
            continue
        hdrs.append(hdr)
    return iodict.IODict(hdrs)
def parse_headers ( obj ) : if isinstance ( obj , basestring ) : obj = cStringIO . StringIO ( obj ) hdrs = [ ] for line in obj : hdr = parse_header ( line ) if not hdr : break if isinstance ( hdr , basestring ) : if not hdrs : raise ValueError ( "First header is a continuation" ) hdrs [ - 1 ] = ( hdrs [ - 1 ] [ 0 ] , hdrs [ - 1 ] [ 1 ] + hdr ) continue hdrs . append ( hdr ) return iodict . IODict ( hdrs )
Parse a string a iterable object (including file like objects) to a
    python dictionary.

    Args:
        obj: An iterable object including file-like objects.

    Returns:
        An dictionary of headers. If a header is repeated then the last value
        for that header is given.

    Raises:
        ValueError: If the first line is a continuation line or the headers
            cannot be parsed.
Parse a string a iterable object ( including file like objects ) to a python dictionary .