input: Write a function to find the sum of amicable numbers within a given range.
  assert sum_amicable_numbers(1, 10000) == 31626
  assert sum_amicable_numbers(1, 5000) == 8442
  assert sum_amicable_numbers(220, 284) == 0
output: def sum_amicable_numbers(start, end):
      def sum_of_divisors(n):
          total = 1
          for i in range(2, int(n**0.5) + 1):
              if n % i == 0:
                  total += i
                  if i != n // i:
                      total += n // i
          return total
      
      def is_amicable(a, b):
          return a != b and sum_of_divisors(a) == b and sum_of_divisors(b) == a
      
      amicable_sum = 0
      for number in range(start, end + 1):
          pair = sum_of_divisors(number)
          if pair > number and pair <= end and is_amicable(number, pair):
              amicable_sum += number + pair
  
      return amicable_sum