def store_sample(self, sample_bytes, filename, type_tag):
        """Store a sample into the datastore.

        Args:
            filename: Name of the file.
            sample_bytes: Actual bytes of sample. 
            type_tag: Type of sample ('exe','pcap','pdf','json','swf', or ...)

        Returns:
            md5 digest of the sample.
        """

        # Temp sanity check for old clients
        if len(filename) > 1000:
            print 'switched bytes/filename... %s %s' % (sample_bytes[:100], filename[:100])
            exit(1)

        sample_info = {}

        # Compute the MD5 hash
        sample_info['md5'] = hashlib.md5(sample_bytes).hexdigest()

        # Check if sample already exists
        if self.has_sample(sample_info['md5']):
            return sample_info['md5']

        # Run the periodic operations
        self.periodic_ops()

        # Check if we need to expire anything
        self.expire_data()

        # Okay start populating the sample for adding to the data store
        # Filename, length, import time and type_tag
        sample_info['filename'] = filename
        sample_info['length'] = len(sample_bytes)
        sample_info['import_time'] = datetime.datetime.utcnow()
        sample_info['type_tag'] = type_tag

        # Random customer for now
        import random
        sample_info['customer'] = random.choice(['Mega Corp', 'Huge Inc', 'BearTron', 'Dorseys Mom'])

        # Push the file into the MongoDB GridFS
        sample_info['__grid_fs'] = self.gridfs_handle.put(sample_bytes)
        self.database[self.sample_collection].insert(sample_info)

        # Print info
        print (self.sample_storage_size(), self.samples_cap) % 'Sample Storage: %.2f out of %.2f MB'

        # Return the sample md5
        return sample_info['md5']
dataset/ETHPy150Open SuperCowPowers/workbench/workbench/server/data_store.py/DataStore.store_sample/swapped operands of `%`