def _deviceId(self, serviceRecord): csp = hashlib.new("md5") csp.update(str(serviceRecord.ExternalID).encode("utf-8")) csp.update(SECRET_KEY.encode("utf-8")) return "tap-" + csp.hexdigest()