(self, key)
return key
Normalise device name to uppercase ascii bytes without colon.
Normalise device name to uppercase ascii bytes without colon.
Normalise device name to uppercase ascii bytes without colon .
def _normalise_device_name(self, key):
        """Normalise device name to uppercase ascii bytes without colon."""
        if not key:
            return b''
        if isinstance(key, text_type):
            try:
                key = key.encode('ascii')
            except UnicodeError:
                logging.error('Invalid device name: `%s` is not ascii.', key)
                return b''
        # strip off trailing : if provided
        if key.endswith(b':'):
            key = key[:-1]
        # convert to uppercase
        key = key.upper()
        return key
def _normalise_device_name ( self , key ) : if not key : return b'' if isinstance ( key , text_type ) : try : key = key . encode ( 'ascii' ) except UnicodeError : logging . error ( 'Invalid device name: `%s` is not ascii.' , key ) return b'' # strip off trailing : if provided if key . endswith ( b':' ) : key = key [ : - 1 ] # convert to uppercase key = key . upper ( ) return key