def list_objects(s3_client, bucket, prefix="", extensions=None, max_items=2147483647):
    """Lists out objects within s3.
    Args:
        s3_client: a low-level client of AWS S3.
        bucket (str): the bucket name
        prefix: (str, optional): bucket prefix
        extensions (str, list, optional): file extensions to filter results by
        max_items (int, optional): only return a subset of items
    Returns:
        keys (list of strings): files within the bucket matching all of the 
            conditions. Files will include prefix.
    Examples:
        >>> s3_client = boto3.client('s3')
        >>> bucket = 'nose-recognition'
        >>> list_objects(s3_client, bucket, prefix='data/train', extensions=['jpg', 'jpeg'])
        [data/train/nose0.jpeg, data/train/nose1.jpg, data/train/nose2.jpeg, data/train/nose3.jpg]
    """
    paginator = s3_client.get_paginator("list_objects_v2")
    page_iterator = paginator.paginate(
        Bucket=bucket, Prefix=prefix, PaginationConfig={"MaxItems": max_items}
    )
    results = page_iterator.search("Contents")
    keys = [el["Key"] for el in results]
    if extensions is not None:
        return [k for k in keys if k.split(".")[-1] in set(extensions)]
    else:
        return keys