def METHOD_NAME(path, user=None, group=None, recursive=False):
    uid = gid = -1
    if user is not None:
        uid = pwd.getpwnam(user)[2]
    if group is not None:
        gid = grp.getgrnam(group)[2]
    for fname in glob.iglob(path):
        os.chown(fname, uid, gid)
        if recursive and os.path.isdir(fname):
            for nested in os.listdir(fname):
                nested = joinpaths(fname, nested)
                METHOD_NAME(nested, user, group, recursive)