asset_update asset_id, [name], [description], [visibility], [group],
                        [users], [ips], [rules], [dns]
        The Asset Update function will update the Asset ID defined with the
        values that have been specified.  Only those specified will be updated
        as a query is first made to pre-populate the update with all of the
        existing information, then override that information with the new data
        presented by the caller.

def asset_update(self, asset_id, name=None, description=None,
                     visibility=None, group=None, users=None,
                     ips=None, rules=None, dns=None):
        '''asset_update asset_id, [name], [description], [visibility], [group],
                        [users], [ips], [rules], [dns]
        The Asset Update function will update the Asset ID defined with the
        values that have been specified.  Only those specified will be updated
        as a query is first made to pre-populate the update with all of the
        existing information, then override that information with the new data
        presented by the caller.
        '''

        payload = None
        # First thing we need to do is query the api for the current asset
        # information and populate the payload with it.
        for asset in self.assets()['assets']:
            if asset['id'] == str(asset_id):
                payload = {
                    'id': asset['id'],
                    'type': asset['type'],
                    'name': asset['name'],
                    'description': asset['description'],
                }
                if self.version[:3] == '4.8':
                    payload['tags'] = asset['tags']
                else:
                    payload['visibility'] = asset['visibility']
                    payload['group'] = asset['group']
                    payload['users'] = asset['users']
                if asset['type'] == 'dynamic':
                    payload['rules'] = asset['rules']
                if asset['type'] == 'static':
                    payload['definedIPs'] = asset['definedIPs']
                if asset['type'] == 'dnsname':
                    payload['definedDNSNames'] = asset['definedDNSNames']


        # New we need to check to see if we actually got to pre-load the
        # payload.  If we didnt, then there isn an existing Asset list and we
        # should error out.
        if payload is None:
            raise APIError(13, 'asset_id %s does not exist' % asset_id)

        # And now we will override any of the values that have actually been
        # specified.
        if name is not None and isinstance(name, str):
            payload['name'] = name
        if description is not None and isinstance(description, str):
            payload['description'] = description
        if self.version[:3] != '4.8':
            if visibility is not None and isinstance(visibility, str):
                payload['visibility'] = visibility
            if group is not None and isinstance(group, str):
                payload['group'] = group
        else:
            if group is not None and isinstance(group, str):
                payload['tags'] = group
        if users is not None and isinstance(users, list):
            ulist = []
            for user in users:
                ulist.append({'id': int(user)})
            payload['users'] = ulist
        if payload['type'] == 'dynamic' and rules is not None and isinstance(rules, list):
            payload['rules'] = rules
        if payload['type'] == 'static' and ips is not None and isinstance(ips, list):
            payload['definedIPs'] = ','.join(ips)
        if payload['type'] == 'dnsname' and dns is not None\
                                        and isinstance(dns, list):
            payload['definedDNSNames'] = ','.join(dns)

        # And now that we have everything defined, we can go ahead and send
        # the api request payload and return the response.
        return self.raw_query('asset', 'edit', data=payload)