<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def open(self, name, attrs=None, *, close=False):
 """Writes an opening element. :name: the name of the element :attrs: a dict of attributes :close: if True, close will be called immediately after writing the element """

    self._pad()
    self._writer.startElement(_normalize_name(name), _normalize_attrs(attrs))
    self._newline()
    self._open_elements.append(name)

    if close:
      self.close()