code: def forward(self, device_port, local_port=None):
          '''adb port forward. return local_port'''
          if local_port is None:
              for s, lp, rp in self.forward_list():
                  if s == self.device_serial() and rp == 'tcp:%d' % device_port:
                      return int(lp[4:])
              return self.forward(device_port, next_local_port(self.server_host))
          else:
              self.cmd("forward", "tcp:%d" % local_port, "tcp:%d" % device_port).wait()
              return local_porf forward(self, device_port, local_port=None):
          '''adb port forward. return local_port'''
          if local_port is None:
              for s, lp, rp in self.forward_list():
                  if s == self.device_serial() and rp == 'tcp:%d' % device_port:
                      return int(lp[4:])
              return self.forward(device_port, next_local_port(self.server_host))
          else:
              self.cmd("forward", "tcp:%d" % local_port, "tcp:%d" % device_port).wait()
              return local_port
docs: adb port forward. return local_port