'change ownership to the given user and group.
user and group may be specified by a number or
by a name.  if rec is True change ownership
recursively.'

def chown(self, user, group, rec=0):

    uid = getuserid(user)
    gid = getgroupid(group)
    if rec:
        for x in self.visit(rec=(lambda x: x.check(link=0))):
            if x.check(link=0):
                py.error.checked_call(os.chown, str(x), uid, gid)
    py.error.checked_call(os.chown, str(self), uid, gid)
