'Translate connector info to storage system host name.
Translate a host\'s name and IP to the prefix of its hostname on the
storage subsystem.  We create a host name from the host and
IP address, replacing any invalid characters (at most 55 characters),
and adding a random 8-character suffix to avoid collisions. The total
length should be at most 63 characters.'

def _connector_to_hostname_prefix(self, connector):

    invalid_ch_in_host = ''
    for num in range(0, 128):
        ch = six.text_type(chr(num))
        if ((not ch.isalnum()) and (ch not in ['    ', '.', '-', '_'])):
            invalid_ch_in_host = (invalid_ch_in_host + ch)
    host_name = connector['host']
    if isinstance(host_name, six.text_type):
        unicode_host_name_filter = {ord(six.text_type(char)): u'-' for char in invalid_ch_in_host}
        host_name = host_name.translate(unicode_host_name_filter)
    elif isinstance(host_name, str):
        string_host_name_filter = string.maketrans(invalid_ch_in_host, ('-' * len(invalid_ch_in_host)))
        host_name = host_name.translate(string_host_name_filter)
    else:
        msg = _('_create_host:    Can    not    translate    host    name.    Host    name    is    not    unicode    or    string.')
        LOG.error(msg)
        raise exception.NoValidBackend(reason=msg)
    host_name = six.text_type(host_name)
    if (not re.match('^[A-Za-z]', host_name)):
        host_name = ('_' + host_name)
    return host_name[:55]
