def IsOnWwan():
  """"Checks WWAN device connection status.

  Note: this may produce false-positives, and may not catch all WWAN
    devices.  Several Sprint and Verizon devices were tested, all of which
    create ppp0 upon connection.  However, L2TP VPN also creates ppp0
    (Google no longer uses this as of Q2-2010 in favor of SSLVPN).  A
    stronger check is probably needed at some point.

    As of 2011-12-6 OpenVPN interface is tun0 on Linux and Darwin.

  Returns:
    Boolean. True if WWAN device is active, False otherwise.
  """
  wwan_ifaces = GetInterfaceNames(INTERFACE_WWAN)
  for wwan_iface in wwan_ifaces:
    try:
      return_code, unused_out, unused_err = flight_common.Exec(
          [IFCONFIG, wwan_iface])
    except __HOLE__:
      return_code = None

    # ifconfig exits with 1 if interface doesn't exist.
    if return_code == 0:
      return True

  return False
dataset/ETHPy150Open google/simian/src/simian/mac/client/network_detect.py/IsOnWwan