def md_from_etree(self, md_element, context=''):
        """Parse rs:md attributes returning a dict of the data

        Parameters:
            md_element  - etree element <rs:md>
            context     - context for error reporting
        """
        md = {}
        # grab all understood attributes into md dict
        for att in ('capability','change','hash','length','path','mime_type',
                    'md_at','md_completed','md_from','md_until'):
            xml_att = self._xml_att_name(att)
            val = md_element.attrib.get(xml_att,None)
            if (val is not None):
                md[att] = val
        # capability. Allow this to be missing but do a very simple syntax
        # check on plausible values if present
        if ('capability' in md):
            if (re.match(r"^[\w\-]+$", md['capability']) is None):
                raise SitemapParseError("Bad capability name '%s' in %s" % (capability,context))
        # change should be one of defined values
        if ('change' in md):
            if (md['change'] not in ['created','updated','deleted'] ):
                self.logger.warning("Bad change attribute in <rs:md> for %s" % (context))
        # length should be an integer
        if ('length' in md):
            try:
                md['length']=int(md['length'])
            except __HOLE__ as e:
                raise SitemapParseError("Invalid length element in <rs:md> for %s" % (context))
        return(md)
dataset/ETHPy150Open resync/resync/resync/sitemap.py/Sitemap.md_from_etree