def split_s3_url(s3_url):
    """
    Breaks up s3 URL into
    bucket
    path under bucked
    tail (file or folder)
    :param s3URL:
    :return: 3 tuple (bucket, folder, tail)
    """
    s3_url_arr = s3_url.rsplit('/')[2:]
    if len(s3_url_arr) > 1:
        return s3_url_arr[0], '/'.join(s3_url_arr[1:-1]), s3_url_arr[-1]
    elif len(s3_url_arr) == 1:
        return s3_url_arr[0], "", ""
    else:
        raise ValueError("'{}' not a valid S3 URL".format(s3_url))