def derive_s3_path(image_path):
    """
    Given a path or s3 key, derives the expected s3 prefix based on the base filename

    Arguments
    ---------
    image_path : string
        the s3 key or file path to an nii.gz file

    Return
    ------

    path, basename : tuple (string, string)
        the path of the image as it would appear on s3 and the basename of the image without
        the extension

    Example
    -------
    >>> path, basename = derive_s3_path("data/ADNI-002_S_0413-20060224-T1w-000.nii.gz")
    >>> print(path)
    "ADNI/002_S_0413/20060224/T1w/000/brain_ext/"
    >>> print(basename)
    "ADNI-002_S_0413-20060224-T1w-000",
    """
    basename = image_path.split('/')[-1].replace('.nii.gz', '')
    loc = basename.split('-')
    path = '/'.join(loc) + '/'
    return path, basename