def format_by_mimetype(text, mimetype):
    formatter = None

    if mimetype in JSONTYPES:
        formatter = JsonFormatter()
    elif mimetype in XMLTYPES:
        formatter = XmlFormatter()

    if formatter:
        return formatter.format(text)
    else:
        return text
dataset/ETHPy150Open chrislongo/HttpShell/httpshell/formatters.py/format_by_mimetype/original