def change_smb_enum_shares(table):
 if (not table):
  return table
 result = {}
 for field in ['account_used', 'note']:
  if (field in table):
   result[field] = table.pop(field)
 result['shares'] = []
 for (key, value) in table.iteritems():
  value.update({'Share': key})
  result['shares'].append(value)
 return result

def change_smb_enum_shares ( table ) : if ( not table ) : return table result = { } for field in [ 'account_used' , 'note' ] : if ( field in table ) : result [ field ] = table . pop ( field ) result [ 'shares' ] = [ ] for ( key , value ) in table . iteritems ( ) : value . update ( { 'Share' : key } ) result [ 'shares' ] . append ( value ) return result
adapt structured data from script smb-enum-shares so that it is easy to query when inserted in db .