def parse_indirect_obj(text: bytes, start=0) -> tuple:
    """Recursively parse indirect object starting at X Y R."""
    bl, el = next_line(text, start)
    bo = bl
    i1, j1, _ = next_token(text, start) #o_num
    i2, j2, _ = next_token(text, j1) #o_gen
    o_num = int(text[i1:j1])
    o_gen = int(text[i2:j2])
    i, j, _ = next_token(text, j2) #obj
    i, j, _ = next_token(text, j) #object1
    o = parse_obj(text, i)
    i, j, t = next_token(text, j)
    if t == 'STREAM':
        _, j, _ = next_token(text, j) #endobj
    return (bo, j, 'IND_OBJ', {'o_num':o_num, 'o_gen':o_gen, 'obj':o})
Recursively parse indirect object starting at X Y R.
pdfsyntax/objects.py