nodes: 0, module; 1, function_definition; 2, function_name:bisect_index; 3, parameters; 4, block; 5, identifier:a; 6, identifier:x; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, raise_statement; 11, comment:""" Find the leftmost index of an element in a list using binary search.
  
      Parameters
      ----------
      a: list
          A sorted list.
      x: arbitrary
          The element.
  
      Returns
      -------
      int
          The index.
  
      """; 12, assignment; 13, boolean_operator; 14, block; 15, identifier:ValueError; 16, identifier:i; 17, call; 18, comparison_operator:i != len(a); 19, comparison_operator:a[i] == x; 20, return_statement; 21, attribute; 22, argument_list; 23, identifier:i; 24, call; 25, subscript; 26, identifier:x; 27, identifier:i; 28, identifier:bisect; 29, identifier:bisect_left; 30, identifier:a; 31, identifier:x; 32, identifier:len; 33, argument_list; 34, identifier:a; 35, identifier:i; 36, identifier:a
code: def bisect_index(a, x):
      """ Find the leftmost index of an element in a list using binary search.
  
      Parameters
      ----------
      a: list
          A sorted list.
      x: arbitrary
          The element.
  
      Returns
      -------
      int
          The index.
  
      """
      i = bisect.bisect_left(a, x)
      if i != len(a) and a[i] == x:
          return i
      raise ValueError