'Return fields as a dict.
Field names will be converted to use the underscore-lowercase style
instead of hyphen-mixed case (i.e. home_page instead of Home-page).'

def todict(self, skip_missing=False):

    self.set_metadata_version()
    mapping_1_0 = ((u'metadata_version', u'Metadata-Version'), (u'name', u'Name'), (u'version', u'Version'), (u'summary', u'Summary'), (u'home_page', u'Home-page'), (u'author', u'Author'), (u'author_email', u'Author-email'), (u'license', u'License'), (u'description', u'Description'), (u'keywords', u'Keywords'), (u'platform', u'Platform'), (u'classifier', u'Classifier'), (u'download_url', u'Download-URL'))
    data = {}
    for (key, field_name) in mapping_1_0:
        if ((not skip_missing) or (field_name in self._fields)):
            data[key] = self[field_name]
    if (self[u'Metadata-Version'] == u'1.2'):
        mapping_1_2 = ((u'requires_dist', u'Requires-Dist'), (u'requires_python', u'Requires-Python'), (u'requires_external', u'Requires-External'), (u'provides_dist', u'Provides-Dist'), (u'obsoletes_dist', u'Obsoletes-Dist'), (u'project_url', u'Project-URL'), (u'maintainer', u'Maintainer'), (u'maintainer_email', u'Maintainer-email'))
        for (key, field_name) in mapping_1_2:
            if ((not skip_missing) or (field_name in self._fields)):
                if (key != u'project_url'):
                    data[key] = self[field_name]
                else:
                    data[key] = [u','.join(u) for u in self[field_name]]
    elif (self[u'Metadata-Version'] == u'1.1'):
        mapping_1_1 = ((u'provides', u'Provides'), (u'requires', u'Requires'), (u'obsoletes', u'Obsoletes'))
        for (key, field_name) in mapping_1_1:
            if ((not skip_missing) or (field_name in self._fields)):
                data[key] = self[field_name]
    return data
