def full_port_name(portname):
 m = re.match('^COM(\\d+)$', portname)
 if (m and (int(m.group(1)) < 10)):
  return portname
 return ('\\\\.\\' + portname)

def full_port_name ( portname ) : m = re . match ( '^COM(\\d+)$' , portname ) if ( m and ( int ( m . group ( 1 ) ) < 10 ) ) : return portname return ( '\\\\.\\' + portname )
given a port-name returns a full name suitable for opening with the serial class .