def hostname_exists(db, hostname):
    """Check if a hostname exists."""
    results = db.servers.find({'hostname': hostname}).count()
    if results > 0:
        logging.info('Hostname %s exists' % hostname)
        return True
    else:
        logging.info('Hostname %s doesn\'t exist' % hostname)
        return False
dataset/ETHPy150Open urbanairship/aerostat/aerostat/aerostat.py/hostname_exists/original