def METHOD_NAME(apps, page_types_and_fields, mapper):
    """Migrate Wagtail StreamFields using the given mapper function.
    page_types_and_fields should be a list of 4-tuples
    providing ('app', 'PageType', 'field_name', ('block_path', )).
    'field_name' is the field on the 'PageType' model.
    'block path' is a tuple containing block names to access the
    StreamBlock type to migrate."""
    ContentType = apps.get_model("contenttypes", "ContentType")
    for app, page_type, field_name, block_path in page_types_and_fields:
        page_model = apps.get_model(app, page_type)
        page_contenttype_id = ContentType.objects.get_for_model(page_model).id
        revision_model = apps.get_model("wagtailcore.Revision")
        for page in page_model.objects.all():
            migrate_stream_field(page, field_name, block_path, mapper)
            revisions = revision_model.objects.filter(
                content_type_id=page_contenttype_id, object_id=page.id
            ).order_by("-id")
            for revision in revisions:
                migrate_stream_field(revision, field_name, block_path, mapper)