Publishes an object to IPNS.

        IPNS is a PKI namespace, where names are the hashes of public keys, and
        the private key enables publishing new (signed) values. In publish, the
        default value of *name* is your own identity public key.

        .. code-block:: python

            >>> c.name_publish('/ipfs/QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZK … GZ5d')
            {'Value': '/ipfs/QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d',
             'Name': 'QmVgNoP89mzpgEAAqK8owYoDEyB97MkcGvoWZir8otE9Uc'}

        Parameters
        ----------
        ipfs_path : str
            IPFS path of the object to be published
        resolve : bool
            Resolve given path before publishing
        lifetime : str
            Time duration that the record will be valid for

            Accepts durations such as ``"300s"``, ``"1.5h"`` or ``"2h45m"``.
            Valid units are:

             * ``"ns"``
             * ``"us"`` (or ``"µs"``)
             * ``"ms"``
             * ``"s"``
             * ``"m"``
             * ``"h"``
        ttl : int
            Time duration this record should be cached for
        key : string
             Name of the key to be used, as listed by 'ipfs key list'.

        Returns
        -------
            dict : IPNS hash and the IPFS path it points at

def name_publish(self, ipfs_path, resolve=True, lifetime="24h", ttl=None,
                     key=None, **kwargs):
        """Publishes an object to IPNS.

        IPNS is a PKI namespace, where names are the hashes of public keys, and
        the private key enables publishing new (signed) values. In publish, the
        default value of *name* is your own identity public key.

        .. code-block:: python

            >>> c.name_publish('/ipfs/QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZK … GZ5d')
            {'Value': '/ipfs/QmfZY61ukoQuCX8e5Pt7v8pRfhkyxwZKZMTodAtmvyGZ5d',
             'Name': 'QmVgNoP89mzpgEAAqK8owYoDEyB97MkcGvoWZir8otE9Uc'}

        Parameters
        ----------
        ipfs_path : str
            IPFS path of the object to be published
        resolve : bool
            Resolve given path before publishing
        lifetime : str
            Time duration that the record will be valid for

            Accepts durations such as ``"300s"``, ``"1.5h"`` or ``"2h45m"``.
            Valid units are:

             * ``"ns"``
             * ``"us"`` (or ``"µs"``)
             * ``"ms"``
             * ``"s"``
             * ``"m"``
             * ``"h"``
        ttl : int
            Time duration this record should be cached for
        key : string
             Name of the key to be used, as listed by 'ipfs key list'.

        Returns
        -------
            dict : IPNS hash and the IPFS path it points at
        """
        opts = {"lifetime": lifetime, "resolve": resolve}
        if ttl:
            opts["ttl"] = ttl
        if key:
            opts["key"] = key
        kwargs.setdefault("opts", opts)

        args = (ipfs_path,)
        return self._client.request('/name/publish', args,
                                    decoder='json', **kwargs)