def METHOD_NAME(f):
    """Decorator to return all schema by name."""
    @wraps(f)
    def wrapper(*args, **kwargs):
        name = kwargs.get('name')
        if name:
            try:
                schemas = Schema.get_all_versions(name)
                kwargs['schemas'] = schemas
            except (JSONSchemaNotFound, IndexError):
                return (
                    jsonify(
                        {
                            'message': 'Schema not found. Please try '
                            'again with existing schemas.'
                        }
                    ),
                    404,
                )
        return f(*args, **kwargs)
    return wrapper