def _rep(obj, expand=False):
 out = dict(obj)
 if isinstance(obj, beets.library.Item):
  if app.config.get('INCLUDE_PATHS', False):
   out['path'] = util.displayable_path(out['path'])
  else:
   del out['path']
  try:
   out['size'] = os.path.getsize(util.syspath(obj.path))
  except OSError:
   out['size'] = 0
  return out
 elif isinstance(obj, beets.library.Album):
  del out['artpath']
  if expand:
   out['items'] = [_rep(item) for item in obj.items()]
  return out

def _rep ( obj , expand = False ) : out = dict ( obj ) if isinstance ( obj , beets . library . Item ) : if app . config . get ( 'INCLUDE_PATHS' , False ) : out [ 'path' ] = util . displayable_path ( out [ 'path' ] ) else : del out [ 'path' ] try : out [ 'size' ] = os . path . getsize ( util . syspath ( obj . path ) ) except OSError : out [ 'size' ] = 0 return out elif isinstance ( obj , beets . library . Album ) : del out [ 'artpath' ] if expand : out [ 'items' ] = [ _rep ( item ) for item in obj . items ( ) ] return out
get a flat -- i .