<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def group_files_by_size(fileslist, multi):  # pragma: no cover
    ''' Cluster files into the specified number of groups, where each groups total size is as close as possible to each other.

    Pseudo-code (O(n^g) time complexity):
    Input: number of groups G per cluster, list of files F with respective sizes
    - Order F by descending size
    - Until F is empty:
        - Create a cluster X
        - A = Pop first item in F
        - Put A in X[0] (X[0] is thus the first group in cluster X)
        For g in 1..len(G)-1 :
            - B = Pop first item in F
            - Put B in X[g]
            - group_size := size(B)
            If group_size != size(A):
                While group_size < size(A):
                    - Find next item C in F which size(C) <= size(A) - group_size
                    - Put C in X[g]
                    - group_size := group_size + size(C)
    '''
    flord = OrderedDict(sorted(fileslist.items(), key=lambda x: x[1], reverse=True))
    if multi <= 1:
        fgrouped = {}
        i = 0
        for x in flord.keys():
            i += 1
            fgrouped[i] = [[x]]
        return fgrouped

    fgrouped = {}
    i = 0
    while flord:
        i += 1
        fgrouped[i] = []
        big_key, big_value = flord.popitem(0)
        fgrouped[i].append([big_key])
        for j in xrange(multi-1):
            cluster = []
            if not flord: break
            child_key, child_value = flord.popitem(0)
            cluster.append(child_key)
            if child_value == big_value:
                fgrouped[i].append(cluster)
                continue
            else:
                diff = big_value - child_value
                for key, value in flord.iteritems():
                    if value <= diff:
                        cluster.append(key)
                        del flord[key]
                        if value == diff:
                            break
                        else:
                            child_value += value
                            diff = big_value - child_value
                fgrouped[i].append(cluster)
    return fgrouped