def add_mock_s3_data(mock_s3_fs, data, time_modified=None, location=None):
 if (time_modified is None):
  time_modified = datetime.utcnow()
 for (bucket_name, key_name_to_bytes) in data.items():
  bucket = mock_s3_fs.setdefault(bucket_name, {'keys': {}, 'location': ''})
  for (key_name, key_data) in key_name_to_bytes.items():
   if (not isinstance(key_data, bytes)):
    raise TypeError('mock s3 data must be bytes')
   bucket['keys'][key_name] = (key_data, time_modified)
  if (location is not None):
   bucket['location'] = location

def add_mock_s3_data ( mock_s3_fs , data , time_modified = None , location = None ) : if ( time_modified is None ) : time_modified = datetime . utcnow ( ) for ( bucket_name , key_name_to_bytes ) in data . items ( ) : bucket = mock_s3_fs . setdefault ( bucket_name , { 'keys' : { } , 'location' : '' } ) for ( key_name , key_data ) in key_name_to_bytes . items ( ) : if ( not isinstance ( key_data , bytes ) ) : raise TypeError ( 'mock s3 data must be bytes' ) bucket [ 'keys' ] [ key_name ] = ( key_data , time_modified ) if ( location is not None ) : bucket [ 'location' ] = location
update mock_s3_fs with a map from bucket name to key name to data and time last modified .