def formatRecords(records, heading):
 (answers, authority, additional) = records
 lines = [('# ' + heading)]
 for a in answers:
  line = [a.name, dns.QUERY_CLASSES.get(a.cls, ('UNKNOWN (%d)' % (a.cls,))), a.payload]
  lines.append(' '.join((str(word) for word in line)))
 return '\n'.join((line for line in lines))

def formatRecords ( records , heading ) : ( answers , authority , additional ) = records lines = [ ( '# ' + heading ) ] for a in answers : line = [ a . name , dns . QUERY_CLASSES . get ( a . cls , ( 'UNKNOWN (%d)' % ( a . cls , ) ) ) , a . payload ] lines . append ( ' ' . join ( ( str ( word ) for word in line ) ) ) return '\n' . join ( ( line for line in lines ) )
extract only the answer records and return them as a neatly formatted string beneath the given heading .