def path_join(*args):
    # The os. routines, as they are implemented on top of Open C
    # functions, they expect and return UTF-8 encoded strings, while
    # internally we use the "unicode" type. Hence we must convert back
    # and forth.
    ll = [ut.to_str(arg) for arg in args if arg is not None]
    return ut.to_unicode(apply(os.path.join, ll))
 def g(p):
     pn = path_join(root, p)
     res = []
     for fn in os.listdir(ut.to_str(pn)):
         fn = ut.to_unicode(fn)
         fnp = path_join(pn, fn)
         if os.path.isdir(ut.to_str(fnp)):
             if not fnmatch.fnmatch(fn, "_*"):
                 res.extend(g(path_join(p, fn)))
         elif os.path.isfile(ut.to_str(fnp)):
             if fnmatch.fnmatch(fn, "*.jpg"):
                 res.append(mk_pic(pn, fn))
     return res