'Creates new temporary cgroup
:param pwd: where to create this cgroup (default: self.root)
:param cgroup: desired cgroup name
:return: last cgroup index'

def mk_cgroup(self, pwd=None, cgroup=None):

    if (pwd is None):
        pwd = self.root
    if isinstance(pwd, int):
        pwd = self.cgroups[pwd]
    try:
        if (cgroup and (self.__get_cgroup_pwd(cgroup) in self.cgroups)):
            raise error.TestFail(('%s    exists!' % cgroup))
        if (not cgroup):
            pwd = (mkdtemp(prefix='cgroup-', dir=pwd) + '/')
        else:
            pwd = (os.path.join(pwd, cgroup) + '/')
            if (not os.path.exists(pwd)):
                os.mkdir(pwd)
    except Exception as inst:
        raise error.TestError(('cg.mk_cgroup():    %s' % inst))
    self.cgroups.append(pwd)
    return (len(self.cgroups) - 1)
