def to_string_reference(user, name):
        """
        Given a key ``name`` and ``user``, this method returns a new name (string ref)
        to address the key value pair in the context of that user.

        :param user: User to whom key belongs.
        :type name: ``str``

        :param name: Original name of the key.
        :type name: ``str``

        :rtype: ``str``
        """
        if not user or not name:
            raise ValueError('Both "user" and "name" must be valid to generate ref.')
        return UserKeyReference(user=user, name=name).ref

        Given a key ``name`` and ``user``, this method returns a new name (string ref)
        to address the key value pair in the context of that user.

        :param user: User to whom key belongs.
        :type name: ``str``

        :param name: Original name of the key.
        :type name: ``str``

        :rtype: ``str``
        
st2common/st2common/models/system/keyvalue.py