Return schema instance for given schema (instance or class)

    :param type|Schema|str schema: instance, class or class name of marshmallow.Schema
    :return: schema instance of given schema (instance or class)

def resolve_schema_instance(schema):
    """Return schema instance for given schema (instance or class)

    :param type|Schema|str schema: instance, class or class name of marshmallow.Schema
    :return: schema instance of given schema (instance or class)
    """
    if isinstance(schema, type) and issubclass(schema, marshmallow.Schema):
        return schema()
    if isinstance(schema, marshmallow.Schema):
        return schema
    try:
        return marshmallow.class_registry.get_class(schema)()
    except marshmallow.exceptions.RegistryError:
        raise ValueError(
            "{!r} is not a marshmallow.Schema subclass or instance and has not"
            " been registered in the Marshmallow class registry.".format(schema)
        )