'Handles the Ansible task when the command is to change a password'

def _handle_change_password(self):

    self.entity = self._find_entity(entity_id=self.entity_id, entity_class=self.entity_class, match_filter=self.match_filter, properties=self.properties, entity_fetcher=self.entity_fetcher)
    if self.module.check_mode:
        self.result['changed'] = True
    else:
        try:
            getattr(self.entity, 'password')
        except AttributeError:
            self.module.fail_json(msg='Entity    does    not    have    a    password    property')
        try:
            setattr(self.entity, 'password', self.properties['password'])
        except AttributeError:
            self.module.fail_json(msg='Password    can    not    be    changed    for    entity')
        self.entity = self._save_entity(entity=self.entity)
        self.result['id'] = self.entity.id
        self.result['entities'].append(self.entity.to_dict())
