nodes: 0, module; 1, function_definition; 2, function_name:find_previous; 3, parameters; 4, block; 5, identifier:element; 6, identifier:l; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, comment:"""
      find previous element in a sorted list
  
      >>> find_previous(0, [0])
      0
      >>> find_previous(2, [1, 1, 3])
      1
      >>> find_previous(0, [1, 2])
      >>> find_previous(1.5, [1, 2])
      1
      >>> find_previous(3, [1, 2])
      2
      """; 11, assignment; 12, pattern_list; 13, call; 14, comment:# current is the last element; 15, block; 16, identifier:length; 17, call; 18, identifier:index; 19, identifier:current; 20, identifier:enumerate; 21, argument_list; 22, if_statement; 23, comment:# current is the first element; 24, if_statement; 25, if_statement; 26, identifier:len; 27, argument_list; 28, identifier:l; 29, comparison_operator:length - 1 == index; 30, block; 31, comparison_operator:index == 0; 32, block; 33, comparison_operator:current <= element < l[index+1]; 34, block; 35, identifier:l; 36, binary_operator:length - 1; 37, identifier:index; 38, return_statement; 39, identifier:index; 40, integer:0; 41, if_statement; 42, identifier:current; 43, identifier:element; 44, subscript; 45, return_statement; 46, identifier:length; 47, integer:1; 48, identifier:current; 49, comparison_operator:element < current; 50, block; 51, identifier:l; 52, binary_operator:index+1; 53, identifier:current; 54, identifier:element; 55, identifier:current; 56, return_statement; 57, identifier:index; 58, integer:1; 59, None
code: def find_previous(element, l):
      """
      find previous element in a sorted list
  
      >>> find_previous(0, [0])
      0
      >>> find_previous(2, [1, 1, 3])
      1
      >>> find_previous(0, [1, 2])
      >>> find_previous(1.5, [1, 2])
      1
      >>> find_previous(3, [1, 2])
      2
      """
      length = len(l)
      for index, current in enumerate(l):
          # current is the last element
          if length - 1 == index:
              return current
  
          # current is the first element
          if index == 0:
              if element < current:
                  return None
  
          if current <= element < l[index+1]:
              return current