def array_offset(x):
    """Get offset of array data from base data in bytes."""
    if x.base is None:
        return 0
    base_start = x.base.__array_interface__['data'][0]
    start = x.__array_interface__['data'][0]
    return start - base_start
