def find_hash_varying_size(self, size):
        """
        Looks for a file with close to size in the database.
        The function assumes build_hash_size_table has already been called.
        
        Returns a list of paths ordered by how close they are to the size.
        """
        size_span = size * self.hash_mode_size_varying / 100
        min_size_span, max_size_span = size - size_span, size + size_span
        
        found_sizes = []
        for db_size in self.hash_size_table:
            if db_size < min_size_span:
                continue
            
            if db_size > max_size_span:
                break
            
            found_sizes.append(db_size)
        
        found_sizes = sorted(found_sizes, key=lambda x:abs(x-size))
        result = []
        for found_size in found_sizes:
            key = str('s:%i' % found_size)
            result += self.db.get(key, [])
        
        return result
dataset/ETHPy150Open JohnDoee/autotorrent/autotorrent/db.py/Database.find_hash_varying_size/original