human
I wrote the below code

    def _get_bsgs(G, base, gens, free_indices):
        '\n                                return    the    BSGS    for    G.pointwise_stabilizer(free_indices)\n                                '
        if (not free_indices):
            return (base[:], gens[:])
        else:
            H = G.pointwise_stabilizer(free_indices)
            (base, sgs) = H.schreier_sims_incremental()
            return (base, sgs)
    if ((not base) and (list_free_indices.count([]) < 2)):
        n = len(list_free_indices)
        size = gens[0].size
        size = ((n * (gens[0].size - 2)) + 2)
        return (size, [], [_af_new(list(range(size)))])
    if any(list_free_indices):
        G = PermutationGroup(gens)
    else:
        G = None
    no_free = []
    size = gens[0].size
    id_af = list(range(size))
    num_indices = (size - 2)
    if (not list_free_indices[0]):
        no_free.append(list(range(num_indices)))
    (res_base, res_gens) = _get_bsgs(G, base, gens, list_free_indices[0])
    for i in range(1, len(list_free_indices)):
        (base1, gens1) = _get_bsgs(G, base, gens, list_free_indices[i])
        (res_base, res_gens) = bsgs_direct_product(res_base, res_gens, base1, gens1, 1)
        if (not list_free_indices[i]):
            no_free.append(list(range((size - 2), ((size - 2) + num_indices))))
        size += num_indices
    nr = (size - 2)
    res_gens = [h for h in res_gens if (h._array_form != id_af)]
    if ((sym is None) or (not no_free)):
        if (not res_gens):
            res_gens = [_af_new(id_af)]
        return (size, res_base, res_gens)
    base_comm = []
    for i in range((len(no_free) - 1)):
        ind1 = no_free[i]
        ind2 = no_free[(i + 1)]
        a = list(range(ind1[0]))
        a.extend(ind2)
        a.extend(ind1)
        base_comm.append(ind1[0])
        a.extend(list(range((ind2[(-1)] + 1), nr)))
        if (sym == 0):
            a.extend([nr, (nr + 1)])
        else:
            a.extend([(nr + 1), nr])
        res_gens.append(_af_new(a))
    res_base = list(res_base)
   ...

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def tensor_gens(base, gens, list_free_indices, sym=0):