def search(misp, **kwargs):
    """
    Search the MISP server and return records that match

    misp: The MISP server connection object
    kwargs: The specification of the search (e.g. controller="attributes", org="CIRCL")
    """

    res = {}

    try:
        r = misp.search(**kwargs)
        if r.get('errors'):
            print("Warning: Errors from get_all_attributes_txt() call")
            print(r["errors"])
        res = r['response']
    except ValueError as e:
        print(e)

    return res