def FormatResults(file_obj, results):
 out = (file_obj.name + ':\n')
 for result in results:
  out += (('  ' + result['name']) + ' fingerprint type\n')
  for (key, value) in sorted(result.items()):
   if (key == 'name'):
    continue
   out += (('    ' + key) + ': ')
   if (type(value) is list):
    for v in value:
     if (type(v) is tuple):
      out += ('(rev=%d, type=%d, cert len=%d bytes)' % (v[0], v[1], len(v[2])))
     else:
      out += (v.encode('hex') + ',')
   else:
    out += value.encode('hex')
   out += '\n'
 return out

def FormatResults ( file_obj , results ) : out = ( file_obj . name + ':\n' ) for result in results : out += ( ( '  ' + result [ 'name' ] ) + ' fingerprint type\n' ) for ( key , value ) in sorted ( result . items ( ) ) : if ( key == 'name' ) : continue out += ( ( '    ' + key ) + ': ' ) if ( type ( value ) is list ) : for v in value : if ( type ( v ) is tuple ) : out += ( '(rev=%d, type=%d, cert len=%d bytes)' % ( v [ 0 ] , v [ 1 ] , len ( v [ 2 ] ) ) ) else : out += ( v . encode ( 'hex' ) + ',' ) else : out += value . encode ( 'hex' ) out += '\n' return out
utility function to print out the results string .