'Change the port.'

@port.setter
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()
