def register_name(
            self, db, hostname, local_ip, instance_id, service,
            service_type, aliases):
        if aliases:
            aliases = list(set(aliases))  # remove any duplicates.
            conflicting_aliases = self.alias_exists(db, aliases)
            if conflicting_aliases:
                # Update Aliases in all hosts to not have said alias anymore.
                self.reset_conflict_aliases(db, conflicting_aliases)

        if aerostat.hostname_exists(db, hostname):
            # hostname already exists, fill in the gap.
            db.servers.update(
                    {'hostname': hostname},
                    {'$set': {
                        'ip': local_ip,
                        'service': service,
                        'service_type': service_type,
                        'instance_id': instance_id,
                        'aliases': aliases}})
        else:
            # This is a new host being added to the service cluster.
            db.servers.insert(
                    {'hostname': hostname,
                     'ip': local_ip,
                     'service': service,
                     'service_type': service_type,
                     'instance_id': instance_id,
                     'aliases': aliases})

        #If registration succeeded
        return True
Insert Hostname -> IP relationship into Aerostat DB.
dataset/ETHPy150Open urbanairship/aerostat/aerostat/registrar.py/Registrar.register_name