import requests


def check_asa_network_object(name, asa):
    """
    This function searches for an existing network object
    :param name: Name of the network object.
    :param asa: The ASA which is searched.
    :return: Returns True if the object exsists, else False
    """
    url = asa.url() + "/api/objects/networkobjects/" + name

    headers = {
        'Content-Type': 'application/json',
        'User-agent': 'REST API Agent',
        'X-Auth-Token': asa.token
    }

    response = requests.request("GET", url, headers=headers, verify=False)

    if response.status_code != 200:
        return False
    else:
        return True