code: def dict_to_element(element_as_dict):
      
  
      if element_as_dict is None:
          return None
      elif isinstance(element_as_dict, ElementTree):
          return element_as_dict.getroot()
      elif isinstance(element_as_dict, ElementType):
          return element_as_dict
      elif not isinstance(element_as_dict, dict):
          raise TypeError('Invalid element dict: {0}'.format(element_as_dict))
  
      if len(element_as_dict) == 0:
          return None
  
      try:
          converted = Element(
              element_as_dict[_ELEM_NAME],
              element_as_dict.get(_ELEM_ATTRIBS, {})
          )
  
          converted.tail = element_as_dict.get(_ELEM_TAIL, u'')
          converted.text = element_as_dict.get(_ELEM_TEXT, u'')
  
          for child in element_as_dict.get(_ELEM_CHILDREN, []):
              converted.append(dict_to_element(child))
  
      except KeyError:
          raise SyntaxError('Invalid element dict: {0}'.format(element_as_dict))
  
      return converted
docs: Converts a Dictionary object to an element. The Dictionary can
      include any of the following tags, only name is required:
          - name (required): the name of the element tag
          - text: the text contained by element
          - tail: text immediately following the element
          - attributes: a Dictionary containing element attributes
          - children: a List of converted child elements