def _median(lst):
  """Returns the median of the input list.

  Args:
    lst: the input list.

  Returns:
    The median of the list, or None if the list is empty/None.
  """
  sorted_lst = sorted(lst)
  length = len(sorted_lst)
  if length % 2:
    return sorted_lst[length // 2]
  return (sorted_lst[length // 2 - 1] + sorted_lst[length // 2]) / 2