code: def as_from(value):
          
          keys = ['port','baudrate','databits','stopbits','parity','protocol']
          values = value.replace(',', ':').split(':')
  
          if len(values) == 5:
              values.append(RTSCTS)
  
          if len(keys) != len(values):
              raise ValueError('Unknown serial port string format: %s '
                      '(expecting something like "COM1:9600,8,1,N,RTSCTS")' % (
                      value,))
  
          kwargs = dict(zip(keys, values))
          kwargs['baudrate'] = int(kwargs['baudrate'])
          kwargs['databits'] = int(kwargs['databits'])
          kwargs['stopbits'] = int(kwargs['stopbits'])
  
          return SerialSettings(**kwargs)
docs: Constructs an instance of :class:`SerialSettings` from a string
          representation, that looks like ``/dev/ttyS0:9600,8,1,N,RTSCTS``,
          describing, in order, the serial port name, baud rate, byte size,
          stop bits, parity and flow control protocol.
  
          Valid string representations are (in cases where protocol is not
          specified, RTS/CTS is assumed)::
  
              COM1:115000,8,1,E
              COM1:115000:8:1:E
              COM4:9600:8:2:O:DSRDTR
              /dev/ttyS0:9600,8,1,N,RTSCTS
              /dev/ttyS0,9600,8,1,N