def METHOD_NAME(site, pages_info, parent=None):
    """
    Recursively create page following tree structure with parent/children.
    Arguments:
        site (django.contrib.sites.models.Site): Site object which page will
            be linked to.
        pages_info (dict): Page items to create recursively such as 'children' key
            value can be a dict to create child pages. The current page is
            given to children for parent relation.
    Keyword Arguments:
        parent (cms.models.pagemodel.Page): Page used as a parent to create
            page item from `pages` argument.
    Returns:
        dict: mapping of the page names passed in argument and the created page instances.
    """
    pages = {}
    for name, kwargs in pages_info.items():
        children = kwargs.pop("children", None)
        if kwargs.get("is_homepage"):
            query_params = {"is_home": True}
        else:
            query_params = {"reverse_id": name}
        try:
            page = Page.objects.get(
                publisher_is_draft=True, node__site=site, **query_params
            )
        except Page.DoesNotExist:
            page = create_i18n_page(
                site=site, parent=parent, published=True, reverse_id=name, **kwargs
            )
        pages[name] = page
        # Create children
        if children:
            children_pages = METHOD_NAME(site, children, parent=page)
            for child_name in children_pages:
                if child_name in pages:
                    raise ImproperlyConfigured(
                        f"Page names should be unique: {child_name:s}"
                    )
            pages.update(children_pages)
    return pages