input: def sort_by_digit_sum(nums):
      """
      Write a function that orders a given list of integers
      in ascending order based on the sum of their digits.
      Note: if multiple elements have the same digit sum,
      preserve their original order in the list.
  
      For example:
      >>> sort_by_digit_sum([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]
      >>> sort_by_digit_sum([]) == []
      """
output:     def digit_sum(n):
          return sum(int(d) for d in str(abs(n)))
  
      nums.sort(key=digit_sum)
      return nums