def lzf_length(raw_data):
    """ Get length of uncompressed data from a header of Compress::LZF
    output. Check Compress::LZF sources for the definition of this bit magic
        (namely, LZF.xs, decompress_sv)

    Args:
        raw_data (bytes): data compressed with Perl Compress::LZF

    Returns:
         Tuple[int, int]: (header_size, uncompressed_content_length) in bytes

    >>> lzf_length('\\xc4\\x9b')
    (2, 283)
    >>> lzf_length('\\xc3\\xa4')
    (2, 228)
    >>> lzf_length('\\xc3\\x8a')
    (2, 202)
    >>> lzf_length('\\xca\\x87')
    (2, 647)
    >>> lzf_length('\\xe1\\xaf\\xa9')
    (3, 7145)
    >>> lzf_length('\\xe0\\xa7\\x9c')
    (3, 2524)
    """
    if not raw_data:
        raise ValueError('LZF compressed data are missing header')
    lower = ord(raw_data[0])
    csize = len(raw_data)
    start = 1
    mask = 128
    while mask and csize > start and lower & mask:
        mask >>= 1 + (mask == 128)
        start += 1
    if not mask or csize < start:
        raise ValueError('LZF compressed data header is corrupted')
    usize = lower & mask - 1
    for i in range(1, start):
        usize = (usize << 6) + (ord(raw_data[i]) & 63)
    if not usize:
        raise ValueError('LZF compressed data header is corrupted')
    return start, usize
