def parse(self, bibtex_contents):
        ret = []
        cleaned_string = bibtex_contents.replace("\&", "").replace("%", "").strip()
        entries = ["@"+entry for entry in cleaned_string.split("@") if entry]
        biblio_list = self._parse_bibtex_entries(entries)

        for biblio in biblio_list:
            parsed = {}
            try:
                mykey = biblio.entries.keys()[0]
            except AttributeError:
                # doesn't seem to be a valid biblio object, so skip to the next one
                logger.info(u"%20s NO DOI because no entries attribute in %s" % (self.provider_name, biblio))
                continue

            try:
                parsed["journal"] = self._to_unicode(biblio.entries[mykey].fields["journal"])
            except KeyError:
                parsed["journal"] = ""


            try:
                lnames = [person.get_part_as_text("last") for person in biblio.entries[mykey].persons["author"]]
                parsed["first_author"] = self._to_unicode(lnames[0])
            except (KeyError, AttributeError):
                try:
                    parsed["first_author"] = self._to_unicode(biblio.entries[mykey].fields["author"][0].split(",")[0])
                except (KeyError, __HOLE__):
                    parsed["first_author"] = ""

            try:
                lnames = [person.get_part_as_text("last") for person in biblio.entries[mykey].persons["author"]]
                parsed["authors"] = self._to_unicode(", ".join(lnames))
            except (KeyError, AttributeError):
                parsed["authors"] = ""

            try:
                parsed["number"] = biblio.entries[mykey].fields["number"]
            except KeyError:
                parsed["number"] = ""

            try:
                parsed["volume"] = biblio.entries[mykey].fields["volume"]
            except KeyError:
                parsed["volume"] = ""

            try:
                pages = biblio.entries[mykey].fields["pages"]
                parsed["first_page"] = pages.split("--")[0]
            except KeyError:
                parsed["first_page"] = ""

            try:
                year_string = biblio.entries[mykey].fields["year"].replace("{}", "")
                parsed["year"] = re.sub("\D", "", year_string)
            except KeyError:
                parsed["year"]  = ""

            try:
                parsed["title"] = self._to_unicode(biblio.entries[mykey].fields["title"])
            except KeyError:
                parsed["title"]  = ""

            #parsed["key"] = mykey

            ret.append(parsed)

        return ret
dataset/ETHPy150Open Impactstory/total-impact-core/totalimpact/providers/bibtex.py/Bibtex.parse