Convert WA-KAT frontend dataset to three output datasets - `MRC`, `MARC`
    and `Dublin core`.

    Conversion is implemented as filling ofthe MRC template, which is then
    converted to MARC record. Dublin core is converted standalone from the
    input dataset.

def to_output(data):
    """
    Convert WA-KAT frontend dataset to three output datasets - `MRC`, `MARC`
    and `Dublin core`.

    Conversion is implemented as filling ofthe MRC template, which is then
    converted to MARC record. Dublin core is converted standalone from the
    input dataset.
    """
    data = json.loads(data)

    # postprocessing
    if "keywords" in data:
        mdt, cz_keywords, en_keywords = compile_keywords(data["keywords"])
        del data["keywords"]

        data["mdt"] = mdt
        data["cz_keywords"] = cz_keywords
        data["en_keywords"] = en_keywords

    data["annotation"] = data["annotation"].replace("\n", " ")
    data["time"] = time  # for date generation

    # convert additional info values to MRC
    ai_key = "additional_info"
    if data.get(ai_key) is None:
        data[ai_key] = {}

    # parse regularity - see https://github.com/WebArchivCZ/WA-KAT/issues/66
    # for details
    fld_008 = data[ai_key].get("008")
    data["regularity"] = fld_008[18] if fld_008 and len(fld_008) > 18 else "-"

    # put lang code to 008
    data["lang_code_008"] = get_008_lang_code(data.get("language"))

    # special format of date - viz #100
    data["date_of_generation"] = _to_date_in_588(time.strftime("%d.%m.%Y"))

    data[ai_key] = {
        key: "\n".join(item_to_mrc(key, val))
        for key, val in data[ai_key].iteritems()
        if val
    }

    alt_end_date = data[ai_key].get("alt_end_date", None)

    # handle date range in the 008
    from_year, to_year = parse_date_range(data["creation_date"], alt_end_date)
    data["from_year"] = from_year
    data["to_year"] = to_year

    # serialize author
    if data["author"]:
        data["serialized_author"] = serialize_author(data["author"])

    # send data to seeder
    if data.get("url_id"):
        send_update(data["url_id"], data)

    # convert to MRC format
    mrc = render_mrc(data).encode("utf-8")

    # create all output formats
    out = {
        "fn": url_to_fn(data["url"]),
        "mrc": mrc,
        "oai": mrc_to_marc(mrc),
        "dc": to_dc(data),
    }

    return out