def print_dict(dct, dict_property='Property', wrap=0, dict_value='Value'):
 pt = prettytable.PrettyTable([dict_property, dict_value])
 pt.align = 'l'
 for (k, v) in sorted(dct.items()):
  if isinstance(v, dict):
   v = six.text_type(v)
  if (wrap > 0):
   v = textwrap.fill(six.text_type(v), wrap)
  if (v and isinstance(v, six.string_types) and ('\\n' in v)):
   lines = v.strip().split('\\n')
   col1 = k
   for line in lines:
    pt.add_row([col1, line])
    col1 = ''
  else:
   pt.add_row([k, v])
 if six.PY2:
  print encodeutils.safe_encode(pt.get_string())
 else:
  print encodeutils.safe_encode(pt.get_string()).decode()

def print_dict ( dct , dict_property = 'Property' , wrap = 0 , dict_value = 'Value' ) : pt = prettytable . PrettyTable ( [ dict_property , dict_value ] ) pt . align = 'l' for ( k , v ) in sorted ( dct . items ( ) ) : if isinstance ( v , dict ) : v = six . text_type ( v ) if ( wrap > 0 ) : v = textwrap . fill ( six . text_type ( v ) , wrap ) if ( v and isinstance ( v , six . string_types ) and ( '\\n' in v ) ) : lines = v . strip ( ) . split ( '\\n' ) col1 = k for line in lines : pt . add_row ( [ col1 , line ] ) col1 = '' else : pt . add_row ( [ k , v ] ) if six . PY2 : print encodeutils . safe_encode ( pt . get_string ( ) ) else : print encodeutils . safe_encode ( pt . get_string ( ) ) . decode ( )
print a dict as a table of two columns .