#NEWLINE# def _to_record_elem( self , name = None , type = None , data = None , extra = None ) : #NEWLINE# #INDENT# record_elem = ET . Element ( 'host' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# if name : #NEWLINE# #INDENT# name_elem = ET . SubElement ( record_elem , 'hostname' ) #NEWLINE# name_elem . text = name #NEWLINE# #UNINDENT# if ( type is not None ) : #NEWLINE# #INDENT# type_elem = ET . SubElement ( record_elem , 'host-type' ) #NEWLINE# type_elem . text = self . RECORD_TYPE_MAP [ type ] #NEWLINE# #UNINDENT# if data : #NEWLINE# #INDENT# data_elem = ET . SubElement ( record_elem , 'data' ) #NEWLINE# data_elem . text = data #NEWLINE# #UNINDENT# if extra : #NEWLINE# #INDENT# if ( 'ttl' in extra ) : #NEWLINE# #INDENT# ttl_elem = ET . SubElement ( record_elem , 'ttl' , { #NEWLINE# #INDENT# 'type' : 'integer' , #NEWLINE# #UNINDENT# } ) #NEWLINE# ttl_elem . text = str ( extra [ 'ttl' ] ) #NEWLINE# #UNINDENT# if ( 'priority' in extra ) : #NEWLINE# #INDENT# priority_elem = ET . SubElement ( record_elem , 'priority' , { #NEWLINE# #INDENT# 'type' : 'integer' , #NEWLINE# #UNINDENT# } ) #NEWLINE# priority_elem . text = str ( extra [ 'priority' ] ) #NEWLINE# #UNINDENT# if ( 'notes' in extra ) : #NEWLINE# #INDENT# notes_elem = ET . SubElement ( record_elem , 'notes' ) #NEWLINE# notes_elem . text = extra [ 'notes' ] #NEWLINE# #UNINDENT# #UNINDENT# return record_elem