Deletes a nameserver. Returns ``True`` if the nameserver was updated
    successfully.

    sld
        SLD of the domain name

    tld
        TLD of the domain name

    nameserver
        Nameserver to create

    old_ip
        Current ip address

    new_ip
        New ip address

    CLI Example:

    .. code-block:: bash

        salt '*' namecheap_domains_ns.update sld tld nameserver old_ip new_ip

def update(sld, tld, nameserver, old_ip, new_ip):
    '''
    Deletes a nameserver. Returns ``True`` if the nameserver was updated
    successfully.

    sld
        SLD of the domain name

    tld
        TLD of the domain name

    nameserver
        Nameserver to create

    old_ip
        Current ip address

    new_ip
        New ip address

    CLI Example:

    .. code-block:: bash

        salt '*' namecheap_domains_ns.update sld tld nameserver old_ip new_ip
    '''
    opts = salt.utils.namecheap.get_opts('namecheap.domains.ns.update')
    opts['SLD'] = sld
    opts['TLD'] = tld
    opts['Nameserver'] = nameserver
    opts['OldIP'] = old_ip
    opts['IP'] = new_ip

    response_xml = salt.utils.namecheap.post_request(opts)
    if response_xml is None:
        return False

    domainnsupdateresult = response_xml.getElementsByTagName('DomainNSUpdateResult')[0]
    return salt.utils.namecheap.string_to_value(domainnsupdateresult.getAttribute('IsSuccess'))