'Load a descriptor from the specified xml_object:
If there is a filename attribute, load it as a string, and
log a warning if it is not parseable by etree.HTMLParser.
If there is not a filename attribute, the definition is the body
of the xml_object, without the root tag (do not want <html> in the
middle of a page)
Args:
xml_object: an lxml.etree._Element containing the definition to load
system: the modulestore system or runtime which caches data
location: the usage id for the block--used to compute the filename if none in the xml_object
id_generator: used by other impls of this method to generate the usage_id'

@classmethod
def load_definition(cls, xml_object, system, location, id_generator):

    filename = xml_object.get('filename')
    if (filename is None):
        definition_xml = copy.deepcopy(xml_object)
        cls.clean_metadata_from_xml(definition_xml)
        return ({'data': stringify_children(definition_xml)}, [])
    else:
        pointer_path = '{category}/{url_path}'.format(category='html', url_path=name_to_pathname(location.name))
        base = path(pointer_path).dirname()
        filepath = '{base}/{name}.html'.format(base=base, name=filename)
        if (not system.resources_fs.exists(filepath)):
            dog_stats_api.increment(DEPRECATION_VSCOMPAT_EVENT, tags=['location:html_descriptor_load_definition'])
            candidates = cls.backcompat_paths(filepath)
            for candidate in candidates:
                if system.resources_fs.exists(candidate):
                    filepath = candidate
                    break
        try:
            with system.resources_fs.open(filepath) as infile:
                html = infile.read().decode('utf-8')
                if ((not check_html(html)) and (len(html) > 0)):
                    msg = "Couldn't    parse    html    in    {0},    content    =    {1}".format(filepath, html)
                    log.warning(msg)
                    system.error_tracker(('Warning:    ' + msg))
                definition = {'data': html}
                definition['filename'] = [filepath, filename]
                return (definition, [])
        except ResourceNotFoundError as err:
            msg = 'Unable    to    load    file    contents    at    path    {0}:    {1}    '.format(filepath, err)
            raise Exception(msg), None, sys.exc_info()[2]
