def strordict_fullname(item, key='fullname'):
 try:
  d = pickle.loads(item)
 except:
  d = {key: item}
 if ((not isinstance(d, dict)) or (key not in d) or (not isinstance(d[key], str))):
  raise ValueError(('Error trying to migrate %r (%r)' % (item, d)))
 return d

def strordict_fullname ( item , key = 'fullname' ) : try : d = pickle . loads ( item ) except : d = { key : item } if ( ( not isinstance ( d , dict ) ) or ( key not in d ) or ( not isinstance ( d [ key ] , str ) ) ) : raise ValueError ( ( 'Error trying to migrate %r (%r)' % ( item , d ) ) ) return d
sometimes we migrate amqp queues from simple strings to pickled dictionaries .