import copy


def expand_mv_fields(documents: list, group_field: str) -> list:
    """
    Expand multivalued fields to separate documents

    :param documents: The list of documents
    :param group_field: The field that may contain a list to expand

    :return: The expanded list of documents
    """
    new_documents = []
    for document in documents:
        if not isinstance(document[group_field], list):
            new_documents.append(document)
            continue

        for val in document[group_field]:
            document_copy = copy.deepcopy(document)
            document_copy[group_field] = val
            new_documents.append(document_copy)

    return new_documents