code: def _cmp_by_local_pref(path1, path2):
      
      # TODO(PH): Revisit this when BGPS has concept of policy to be applied to
      # in-bound NLRIs.
      # Default local-pref values is 100
      lp1 = path1.get_pattr(BGP_ATTR_TYPE_LOCAL_PREF)
      lp2 = path2.get_pattr(BGP_ATTR_TYPE_LOCAL_PREF)
      if not (lp1 and lp2):
          return None
  
      # Highest local-preference value is preferred.
      lp1 = lp1.value
      lp2 = lp2.value
      if lp1 > lp2:
          return path1
      elif lp2 > lp1:
          return path2
      else:
          return None
docs: Selects a path with highest local-preference.
  
      Unlike the weight attribute, which is only relevant to the local
      router, local preference is an attribute that routers exchange in the
      same AS. Highest local-pref is preferred. If we cannot decide,
      we return None.