def repr_attrs(instance, *attrs):
 orig_repr_template = '<{0.__class__.__module__}.{0.__class__.__name__} object at {1:#x}'
 if attrs:
  repr_template = ((orig_repr_template + ': ') + ', '.join(['{0}={{0.{0}}}'.format(attr) for attr in attrs]))
 repr_template += '>'
 orig_repr_template += '>'
 try:
  return repr_template.format(instance, id(instance))
 except Exception:
  return orig_repr_template.format(instance, id(instance))

def repr_attrs ( instance , * attrs ) : orig_repr_template = '<{0.__class__.__module__}.{0.__class__.__name__} object at {1:#x}' if attrs : repr_template = ( ( orig_repr_template + ': ' ) + ', ' . join ( [ '{0}={{0.{0}}}' . format ( attr ) for attr in attrs ] ) ) repr_template += '>' orig_repr_template += '>' try : return repr_template . format ( instance , id ( instance ) ) except Exception : return orig_repr_template . format ( instance , id ( instance ) )
prints a representation of an object with certain attributes .