def gpg_profile_put_key( blockchain_id, key_id, key_name=None, immutable=True, txid=None, key_url=None, use_key_server=True, key_server=None, proxy=None, wallet_keys=None, gpghome=None ):
    """
    Put a local GPG key into a blockchain ID's global account.
    If the URL is not given, the key will be replicated to the default PGP key server and to either immutable (if @immutable) or mutable data.

    Return {'status': True, 'key_url': key_url, 'key_id': key fingerprint, ...} on success
    Return {'error': ...} on error
    """

    if key_name is not None:
        assert is_valid_keyname(key_name)

    if key_server is None:
        key_server = DEFAULT_KEY_SERVER 

    if gpghome is None:
        gpghome = get_default_gpg_home()

    put_res = {}
    extra_fields = {}
    key_data = None
    if key_name is not None:
        extra_fields = {'keyName': key_name}

    if key_url is None:

        gpg = gnupg.GPG( homedir=gpghome )

        if use_key_server:
            # replicate key data to default server first 
            res = gpg.send_keys( key_server, key_id )
            if len(res.data) > 0:
                # error 
                log.error("GPG failed to upload key '%s'" % key_id)
                log.error("GPG error:\n%s" % res.stderr)
                return {'error': 'Failed to repliate GPG key to default keyserver'}

        key_data = gpg.export_keys( [key_id] )

        if immutable:
            # replicate to immutable storage 
            immutable_result = client.put_immutable( blockchain_id, key_id, {key_id: key_data}, proxy=proxy, txid=txid, wallet_keys=wallet_keys )
            if 'error' in immutable_result:
                return {'error': 'Failed to store hash of key %s to the blockchain.  Error message: "%s"' % (key_id, immutable_result['error'])}

            else:
                put_res['transaction_hash'] = immutable_result['transaction_hash']
                put_res['zonefile_hash'] = immutable_result['zonefile_hash']

            key_url = client.make_immutable_data_url( blockchain_id, key_id, client.get_data_hash(key_data) )

        else:
            # replicate to mutable storage 
            mutable_name = key_name
            if key_name is None:
                mutable_name = key_id

            mutable_result = client.put_mutable( blockchain_id, key_id, {mutable_name: key_data}, proxy=proxy, wallet_keys=wallet_keys )
            if 'error' in mutable_result:
                return {'error': 'Failed to store key %s.  Error message: "%s"' % (key_id, mutable_result['error'])}

            key_url = client.make_mutable_data_url( blockchain_id, key_id, mutable_result['version'] ) 

    put_account_res = client.put_account( blockchain_id, "pgp", key_id, key_url, proxy=proxy, wallet_keys=wallet_keys, **extra_fields )
    if 'error' in put_account_res:
        return put_account_res

    else:
        put_account_res.update( put_res )
        put_account_res['key_url'] = key_url
        put_account_res['key_id'] = key_id
        return put_account_res