def get_value(self, name, local=True, scope=SYSTEM_SCOPE, decrypt=False):
        """
        Retrieve a value from the datastore for the provided key.

        By default, value is retrieved from the namespace local to the pack/class. If you want to
        retrieve a global value from a datastore, pass local=False to this method.

        :param name: Key name.
        :type name: ``str``

        :param local: Retrieve value from a namespace local to the pack/class. Defaults to True.
        :type: local: ``bool``

        :param scope: Scope under which item is saved. Defaults to system scope.
        :type: local: ``str``

        :param decrypt: Return the decrypted value. Defaults to False.
        :type: local: ``bool``

        :rtype: ``str`` or ``None``
        """
        if scope != SYSTEM_SCOPE:
            raise ValueError("Scope %s is unsupported." % scope)

        name = self._get_full_key_name(name=name, local=local)

        client = self.get_api_client()
        self._logger.debug("Retrieving value from the datastore (name=%s)", name)

        try:
            params = {"decrypt": str(decrypt).lower(), "scope": scope}
            kvp = client.keys.get_by_id(id=name, params=params)
        except Exception as e:
            self._logger.exception(
                "Exception retrieving value from datastore (name=%s): %s", name, e
            )
            return None

        if kvp:
            return kvp.value

        return None

        Retrieve a value from the datastore for the provided key.

        By default, value is retrieved from the namespace local to the pack/class. If you want to
        retrieve a global value from a datastore, pass local=False to this method.

        :param name: Key name.
        :type name: ``str``

        :param local: Retrieve value from a namespace local to the pack/class. Defaults to True.
        :type: local: ``bool``

        :param scope: Scope under which item is saved. Defaults to system scope.
        :type: local: ``str``

        :param decrypt: Return the decrypted value. Defaults to False.
        :type: local: ``bool``

        :rtype: ``str`` or ``None``
        
st2common/st2common/services/datastore.py