def shellglob(args):
 expanded = []
 unescape = (unescape_glob if (sys.platform != 'win32') else (lambda x: x))
 for a in args:
  expanded.extend((glob.glob(a) or [unescape(a)]))
 return expanded

def shellglob ( args ) : expanded = [ ] unescape = ( unescape_glob if ( sys . platform != 'win32' ) else ( lambda x : x ) ) for a in args : expanded . extend ( ( glob . glob ( a ) or [ unescape ( a ) ] ) ) return expanded
do glob expansion for each element in args and return a flattened list .