# Copyright (c) 2018 CloudZero - ALL RIGHTS RESERVED - PROPRIETARY AND CONFIDENTIAL
# Unauthorized copying of this file and/or project, via any medium is strictly prohibited.
# Direct all questions to legal@cloudzero.com
import socket


def hostname_resolves(hostname):
    try:
        socket.gethostbyname(hostname)
        return True
    except (OSError, TypeError):
        return False
