import re


def sanitize_host(host):
    """ Removes extraneous characters from a hostname, leaves an IP untouched. """
    if re.match(r'[a-zA-Z]', host):
        return host.split()[0].strip().replace('_', '-').replace('.', '')
    else:
        return host