input: from typing import List
  
  def linear_search(arr: List, x: int) -> int:
      """ Optimize the following python code using best practices:
      >>> linear_search([3, 1, 4, 1, 5, 9], 5)
      4
      >>> linear_search([3, 1, 4, 1, 5, 9], 2)
      -1
      """
      for index, item in enumerate(arr):
          if item == x:
              return index
      return -1
output:     for index, item in enumerate(arr):
          if item == x:
              return index
      return -1