def get_s3_object(bucket, url):
    """Uses a valid S3 bucket to retrieve a file from a remote AWS URL.
    Raises ValueError if non-existent.

    Parameters
    ----------
    bucket : S3 bucket
        Must have been created similar to
        ``boto3.session.Session().resource('s3').Bucket(BUCKET_NAME)``

    url : str
        The remote URL of the object to be fetched

    Returns
    -------
    S3 object
    """

    # Retrieve a collection of S3 objects with that prefix and check first item in it
    result = list(bucket.objects.filter(Prefix=url))
    if len(result) == 0:
        raise ValueError(url, 'cannot be found!')
    return result[0]