def ensure_list_from_str_or_list(x, lineno=None, col=None):
 return ast.IfExp(test=ast.Call(func=ast.Name(id='isinstance', ctx=ast.Load(), lineno=lineno, col_offset=col), args=[x, ast.Name(id='str', ctx=ast.Load(), lineno=lineno, col_offset=col)], keywords=[], starargs=None, kwargs=None, lineno=lineno, col_offset=col), body=ast.List(elts=[x], ctx=ast.Load(), lineno=lineno, col_offset=col), orelse=x, lineno=lineno, col_offset=col)

def ensure_list_from_str_or_list ( x , lineno = None , col = None ) : return ast . IfExp ( test = ast . Call ( func = ast . Name ( id = 'isinstance' , ctx = ast . Load ( ) , lineno = lineno , col_offset = col ) , args = [ x , ast . Name ( id = 'str' , ctx = ast . Load ( ) , lineno = lineno , col_offset = col ) ] , keywords = [ ] , starargs = None , kwargs = None , lineno = lineno , col_offset = col ) , body = ast . List ( elts = [ x ] , ctx = ast . Load ( ) , lineno = lineno , col_offset = col ) , orelse = x , lineno = lineno , col_offset = col )
creates the ast node for the following expression:: [x] if isinstance else x somewhat useful .