Module([Expr(Lambda(arguments([Name('S', Param()), Name('b', Param())],
    None, None, []), Subscript(Tuple([Call(Name('g', Load()), [Subscript(
    Name('S', Load()), Slice(Num(1), None, None), Load()), Name('b', Load()
    )], [], None, None), Name('S', Load())], Load()), Index(Compare(Call(
    Name('len', Load()), [Name('S', Load())], [], None, None), [Eq()], [
    Name('b', Load())])), Load())))])
Recursion with ternary operator 'hack' in Python