input: Write a function to return a random element from a given list. If the list is empty, return None.
  
  import random
  
  def get_random_element(elements):
      if len(elements) == 0:
          return None
      random_index = random.randint(0, len(elements) - 1)
      return elements[random_index]
  
  assert get_random_element(["apple", "banana", "mango", "pear", "grape"]) in ["apple", "banana", "mango", "pear", "grape"]
  assert get_random_element([]) == None
  
output: import random
  
  def get_random_element(elements):
      if len(elements) == 0:
          return None
      random_index = random.randint(0, len(elements) - 1)
      return elements[random_index]