def __get_attributes(elements, params):
    """Get elements using element's attributes.

    Parameters:
    - elements [list] : List of elements to filter for its attributes
    - params [dict] : A dict that contains elements to search the element for
    Returns:
    - output [WebElement list] : A subset list of found WebElements inside elements argument
    """
    params_tmp = params.copy()
    elements_tmp = elements.copy()
    found = False
    ret_items = []
    while len(params_tmp) > 0:
        for item in elements_tmp:
            key = next(iter(params_tmp))
            if key == 'text':
                if item.text == params_tmp.get('text'):
                    found = True
            elif key == 'tag_name_attribute':
                if item.tag_name == params_tmp.get('tag_name_attribute'):
                    found = True
            elif item.get_attribute(key) == params_tmp.get(key):
                found = True
            if found:
                ret_items.append(item)
            found = False
        del params_tmp[key]
        if len(ret_items) > 0 and len(params_tmp) > 0:
            elements_tmp = ret_items
            ret_items = []
    return ret_items
