def create_badge_blueprint(allowed_types):
from invenio_formatter.context_processors.badges importgenerate_badge_png, generate_badge_svg<EOL>blueprint = Blueprint(<EOL>'<STR_LIT>',<EOL>__name__,<EOL>template_folder='<STR_LIT>',<EOL>)<EOL>@blueprint.route(<EOL>'<STR_LIT>'.format(<EOL>'<STR_LIT:U+002CU+0020>'.join(allowed_types)))<EOL>def badge(title, value, ext='<STR_LIT>'):<EOL><INDENT>"""<STR_LIT>"""<EOL>if ext == '<STR_LIT>':<EOL><INDENT>generator = generate_badge_svg<EOL>mimetype = '<STR_LIT>'<EOL><DEDENT>elif ext == '<STR_LIT>':<EOL><INDENT>generator = generate_badge_png<EOL>mimetype = '<STR_LIT>'<EOL><DEDENT>badge_title_mapping =current_app.config['<STR_LIT>'].get(<EOL>title, title)<EOL>response = Response(generator(badge_title_mapping, value),<EOL>mimetype=mimetype)<EOL>hashable_badge = "<STR_LIT>".format(badge_title_mapping,<EOL>value).encode('<STR_LIT:utf-8>')<EOL>response.set_etag(hashlib.sha1(hashable_badge).hexdigest())<EOL>response.headers["<STR_LIT>"] = "<STR_LIT>"<EOL>response.cache_control.no_cache = True<EOL>response.cache_control.max_age =current_app.config['<STR_LIT>']<EOL>response.last_modified = dt.utcnow()<EOL>extra = timedelta(<EOL>seconds=current_app.config['<STR_LIT>'])<EOL>response.expires = response.last_modified + extra<EOL>return response.make_conditional(request)<EOL><DEDENT>return blueprint<EOL>
Create the badge blueprint.

    :param allowed_types: A list of allowed types.
    :returns: A Flask blueprint.