def list_keys(client, bucket, prefix, token=None):
    """
    Recursive function used to retrieve all the object keys that match with a given prefix in the given S3 bucket.
    :param client: Client for the Amazon S3 service.
    :param bucket: The S3 bucket name.
    :param prefix: The prefix used for filtering.
    :param token: The continuation token returned by a previous call.
    :return: The found keys matching the prefix.
    """
    keys = list()
    response = client.list_objects_v2(
        Bucket=bucket,
        Prefix=prefix,
        ContinuationToken=token
    ) if token else client.list_objects_v2(
        Bucket=bucket,
        Prefix=prefix
    )
    if 'Contents' in response:
        for item in response['Contents']:
            keys.append(item['Key'])
        if 'NextContinuationToken' in response:
            keys += list_keys(client, bucket, prefix, response['NextContinuationToken'])
    return keys