Convert :class:`.MARCXMLRecord` object to :class:`.EPublication`
        namedtuple.

        Args:
            xml (str/MARCXMLRecord): MARC XML which will be converted to
                EPublication. In case of str, ``<record>`` tag is required.

        Returns:
            structure: :class:`.EPublication` namedtuple with data about \
                       publication.

def from_xml(xml):
        """
        Convert :class:`.MARCXMLRecord` object to :class:`.EPublication`
        namedtuple.

        Args:
            xml (str/MARCXMLRecord): MARC XML which will be converted to
                EPublication. In case of str, ``<record>`` tag is required.

        Returns:
            structure: :class:`.EPublication` namedtuple with data about \
                       publication.
        """
        parsed = xml
        if not isinstance(xml, MARCXMLRecord):
            parsed = MARCXMLRecord(str(xml))

        # check whether the document was deleted
        if "DEL" in parsed.datafields:
            raise DocumentNotFoundException("Document was deleted.")

        # convert Persons objects to amqp's Authors namedtuple
        authors = map(
            lambda a: Author(
                (a.name + " " + a.second_name).strip(),
                a.surname,
                a.title
            ),
            parsed.get_authors()
        )

        # i know, that this is not PEP8, but you dont want to see it without
        # proper formating (it looks bad, really bad)
        return EPublication(
            ISBN                = parsed.get_ISBNs(),
            invalid_ISBN        = parsed.get_invalid_ISBNs(),
            id_number           = parsed.controlfields.get("001", None),
            nazev               = parsed.get_name(),
            podnazev            = parsed.get_subname(),
            vazba               = _first_or_blank_string(parsed.get_binding()),
            cena                = parsed.get_price(),
            castDil             = parsed.get_part(),
            nazevCasti          = parsed.get_part_name(),
            nakladatelVydavatel = parsed.get_publisher(),
            datumVydani         = parsed.get_pub_date(),
            poradiVydani        = parsed.get_pub_order(),
            zpracovatelZaznamu  = _first_or_blank_string(parsed["040a"]),
            format              = parsed.get_format(),
            url                 = parsed.get_urls(),
            mistoVydani         = parsed.get_pub_place(),
            ISBNSouboruPublikaci= [],
            autori              = authors,
            originaly           = parsed.get_originals(),
            internal_url        = parsed.get_internal_urls(),
            anotace             = None, # TODO: read the annotation
        )