docs: def calculate_costs(self, detections_1, detections_2, calculate_match_cost, params):
          """
          Calculates assignment costs between detections and 'empty' spaces. The smaller cost the better.
  
          @param detections_1: cell list of size n in previous frame
          @param detections_2: cell list of size m in current frame
  
          @return: cost matrix (n+m)x(n+m) extended by cost of matching cells with emptiness
          """
          global invalid_match
  
          size_sum = len(detections_1) + len(detections_2)
  
          # Cost matrix extended by matching cells with nothing
          # (for detection 1 it means losing cells, for detection 2 it means new cells).
          cost_matrix = numpy.zeros((size_sum, size_sum))
  
          # lost cells cost
          cost_matrix[0:len(detections_1), len(detections_2):size_sum] = params["default_empty_cost"] + (1 - numpy.eye(
              len(detections_1), len(detections_1))) * invalid_match
  
          # new cells cost
          cost_matrix[len(detections_1):size_sum, 0:len(detections_2)] = params["default_empty_cost"] + (1 - numpy.eye(
              len(detections_2), len(detections_2))) * invalid_match
  
          # increase costs for reliable detections
          for row in [i for i in range(0, len(detections_1)) if detections_1[i].is_reliable() and (
              not params["check_if_big"] or self.is_cell_big(detections_1[i]))]:
              cost_matrix[row, len(detections_2):size_sum] *= params["default_empty_reliable_cost_mult"]
  
          for col in [i for i in range(0, len(detections_2)) if detections_2[i].is_reliable() and (
              not params["check_if_big"] or self.is_cell_big(detections_2[i]))]:
              cost_matrix[len(detections_1):size_sum, col] *= params["default_empty_reliable_cost_mult"]
  
          # calculate cost of matching cells
          def cost_if_not_too_far(detection_1, detection_2):
              if detection_1.distance(detection_2) <= self.parameters_tracking["max_distance"]:
                  return calculate_match_cost(detection_1, detection_2)
              else:
                  return invalid_match
  
          cost_matrix[0:len(detections_1), 0:len(detections_2)] = [[cost_if_not_too_far(d1, d2) for d2 in detections_2] for d1 in detections_1]
  
          return cost_matrix