<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_host(host, default_protocol='telnet', default_domain=''):
 """ Given a string or a Host object, this function returns a Host object. :type host: string|Host :param host: A hostname (may be URL formatted) or a Host object. :type default_protocol: str :param default_protocol: Passed to the Host constructor. :type default_domain: str :param default_domain: Appended to each hostname that has no domain. :rtype: Host :return: The Host object. """

    if host is None:
        raise TypeError('None can not be cast to Host')
    if hasattr(host, 'get_address'):
        return host
    if default_domain and not '.' in host:
        host += '.' + default_domain
    return Exscript.Host(host, default_protocol=default_protocol)