parameters: (self, port)
docstring: \
          Change the port.
docstring_summary: \
          Change the port.
docstring_tokens: \ Change the port .
function: def port(self, port):
          """\
          Change the port.
          """
          if port is not None and not isinstance(port, basestring):
              raise ValueError('"port" must be None or a string, not {}'.format(type(port)))
          was_open = self.is_open
          if was_open:
              self.close()
          self.portstr = port
          self._port = port
          self.name = self.portstr
          if was_open:
              self.open()
function_tokens: def port ( self , port ) : if port is not None and not isinstance ( port , basestring ) : raise ValueError ( '"port" must be None or a string, not {}' . format ( type ( port ) ) ) was_open = self . is_open if was_open : self . close ( ) self . portstr = port self . _port = port self . name = self . portstr if was_open : self . open ( )