<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_adjustments(self, adjustments, method):
 """ Merge ``adjustments`` with existing adjustments, handling index collisions according to ``method``. Parameters adjustments : dict[int -> list[Adjustment]] The mapping of row indices to lists of adjustments that should be appended to existing adjustments. method : {'append', 'prepend'} How to handle index collisions. If 'append', new adjustments will be applied after previously-existing adjustments. If 'prepend', new adjustments will be applied before previously-existing adjustments. """

        try:
            merge_func = _merge_methods[method]
        except KeyError:
            raise ValueError(
                "Invalid merge method %s\n"
                "Valid methods are: %s" % (method, ', '.join(_merge_methods))
            )

        self.adjustments = merge_with(
            merge_func,
            self.adjustments,
            adjustments,
        )