def check_depth(a, deep_level, ifnotraise=True):
    """Check if input list has desired level of nested lists"""
    MAX_ITER = 10
    lev = 0
    while lev < MAX_ITER:
        try:
            a = a[0]
            lev += 1
        except:
            break
    if not lev == deep_level:
        if ifnotraise:
            raise Exception(
                'Wrong input nested level. Excepted %i, got %i\n %s' % (
                deep_level, lev, a))
        else:
            return False
    return True
