def get_prefixes(bucket, prefix=None):
    """Retrieves the directories for a bucket using the prefix
    Args:
        bucket (obj): Bucket object to retrieve prefixes against
        prefix (str): Prefix to look for nested prefixes underneath
    """
    iterator = bucket.list_blobs(prefix=prefix, delimiter="/")
    prefixes = []
    for page in iterator.pages:
        prefixes.extend(list(page.prefixes))
    return prefixes