'Pull and install a plugin.
Args:
remote_name (string): Remote reference for the plugin to
install. The ``:latest`` tag is optional, and is the
default if omitted.
local_name (string): Local name for the pulled plugin.
The ``:latest`` tag is optional, and is the default if
omitted. Optional.
Returns:
(:py:class:`Plugin`): The installed plugin
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.'

def install(self, remote_name, local_name=None):

    privileges = self.client.api.plugin_privileges(remote_name)
    it = self.client.api.pull_plugin(remote_name, privileges, local_name)
    for data in it:
        pass
    return self.get((local_name or remote_name))
