def create_onvif_service(self, name, from_template=True, portType=None):
        '''Create ONVIF service client'''

        name = name.lower()
        xaddr, wsdl_file = self.get_definition(name)

        with self.services_lock:
            svt = self.services_template.get(name)
            # Has a template, clone from it. Faster.
            if svt and from_template and self.use_services_template.get(name):
                service = ONVIFService.clone(svt, xaddr, self.user,
                                             self.passwd, wsdl_file,
                                             self.cache_location,
                                             self.cache_duration,
                                             self.encrypt,
                                             self.daemon,
                                             no_cache=self.no_cache, portType=portType, dt_diff=self.dt_diff)
            # No template, create new service from wsdl document.
            # A little time-comsuming
            else:
                service = ONVIFService(xaddr, self.user, self.passwd,
                                       wsdl_file, self.cache_location,
                                       self.cache_duration, self.encrypt,
                                       self.daemon, no_cache=self.no_cache, portType=portType, dt_diff=self.dt_diff)

            self.services[name] = service

            setattr(self, name, service)
            if not self.services_template.get(name):
                self.services_template[name] = service

        return service
Create ONVIF service client