def normalize_domain(mydomain): """ Nextdoor-nomalize the passed domainname. Args: mydomain (str): the domainname to normalize Returns: a normalized hostname as a string """ return utils.normalize_hostname_to_rfc(mydomain)
def normalize_hostname(myservername, myinstanceid): """ Generate Nextdoor-normalized hostname w/ embedded Amazon instance ID. Args: myservername (str): the servername minus the instance ID myinstanceid (str): the Amazon instand ID Returns: string with normalized Nextdoor-legit hostname """ myinstanceid = re.sub('[-]+', '', myinstanceid) return re.sub('\.', '', utils.normalize_hostname_to_rfc("{}-{}".format(myservername, myinstanceid)))