def AddPreferredNetwork(interface, ssid, security, index=-1, password=None,
                        sudo_password=None):
  security = security.upper()
  if security not in _SECURITY_TYPES:
    raise BadSecurityTypeError

  args = [_NETWORK_SETUP, '-addpreferredwirelessnetworkatindex', interface,
          ssid, str(index), security]
  if password:
    args.append(password)

  _, stderr, rc = gmacpyutil.RunProcess(args, sudo=bool(sudo_password),
                                        sudo_password=sudo_password)
  if rc:
    raise PreferenceAdditionError(stderr)
Adds |ssid| to the list of preferred networks on |interface|.
dataset/ETHPy150Open google/macops/gmacpyutil/gmacpyutil/wifi_network_order.py/AddPreferredNetwork