def remaining_data_length(node=None, parent=None, attr_index=None, rawdata=
    None, new_value=None, *args, **kwargs):
    """
    Size getter for the amount of data left in the rawdata
    starting at kwargs['offset'] + kwargs['root_offset']

    If not provided, offset and root_offset default to 0.
    """
    if new_value is not None:
        return
    if rawdata is not None:
        return len(rawdata) - kwargs.get('offset', 0) + kwargs.get(
            'root_offset', 0)
    elif parent is not None:
        remainder = parent[attr_index]
        try:
            return len(remainder)
        except Exception:
            pass
    return 0
