'The purpose of this function is to be robust to improper connections
settings provided by users, specifically in the host field.
For example -- when users supply ``https://xx.cloud.databricks.com`` as the
host, we must strip out the protocol to get the host.
>>> h = DatabricksHook()
>>> assert h._parse_host(\'https://xx.cloud.databricks.com\') ==             \'xx.cloud.databricks.com\'
In the case where users supply the correct ``xx.cloud.databricks.com`` as the
host, this function is a no-op.
>>> assert h._parse_host(\'xx.cloud.databricks.com\') == \'xx.cloud.databricks.com\''

def _parse_host(self, host):

    urlparse_host = urlparse.urlparse(host).hostname
    if urlparse_host:
        return urlparse_host
    else:
        return host
