import ast


def gen_subscript(var_name, index):
    """ Generates code like variable[1]  """
    return ast.Expr(value=ast.Subscript(value=ast.Name(id=var_name, ctx=ast.Load()),
                                        slice=ast.Index(value=ast.Num(n=index, kind="")), ctx=ast.Load()))