Write funding section. There are likely multiple entries.
        :param dict d:
        :return none:
3179
def __write_funding(self):
        
        self.__reorganize_funding()
        # if funding is empty, insert a blank entry so that it'll still write the empty section on the template.
        if not self.noaa_data_sorted["Funding_Agency"]:
            self.noaa_data_sorted["Funding_Agency"].append({"grant": "", "agency": ""})
        for idx, entry in enumerate(self.noaa_data_sorted["Funding_Agency"]):
            logger_lpd_noaa.info("funding: {}".format(idx))
            self.__write_generic('Funding_Agency', entry)
        return
812707
void section(int nclusters)
    {
        if (size() < nclusters)
            return;

        sectioned_clusters_ = new ArrayList<Cluster<K>>(nclusters);
        List<Document> centroids = new ArrayList<Document>(nclusters);
        // choose_randomly(nclusters, centroids);
        choose_smartly(nclusters, centroids);
        for (int i = 0; i < centroids.size(); i++)
        {
            Cluster<K> cluster = new Cluster<K>();
            sectioned_clusters_.add(cluster);
        }

        for (Document<K> d : documents_)
        {
            double max_similarity = -1.0;
            int max_index = 0;
            for (int j = 0; j < centroids.size(); j++)
            {
                double similarity = SparseVector.inner_product(d.feature(), centroids.get(j).feature());
                if (max_similarity < similarity)
                {
                    max_similarity = similarity;
                    max_index = j;
                }
            }
            sectioned_clusters_.get(max_index).add_document(d);
        }
    }
10233
def __reorganize_funding(self):
        
        _map = {"agency": "Funding_Agency_Name", "grant": "Grant"}
        try:
            _l = []
            for item in self.noaa_data_sorted["Funding_Agency"]:
                _tmp = {}
                for lpd_name, noaa_name in _map.items():
                    val = ""
                    if lpd_name in item:
                        val = item[lpd_name]
                    _tmp[noaa_name] = val
                _l.append(_tmp)
            self.noaa_data_sorted["Funding_Agency"] = _l
        except Exception:
            pass
        return
221177
def _prt_py_section(self, prt, section_name, ntgos):
        """"""
        prt.write('    ("{SEC}", [ # {N} GO-headers\n'.format(SEC=section_name, N=len(ntgos)))
        self.prt_ntgos(prt, ntgos)
        prt.write("    ]),\n")
642557
def per_section(it, is_delimiter=lambda x: x.isspace()):
    
    ret = []
    for line in it:
        if is_delimiter(line):
            if ret:
                yield ret  # OR  ''.join(ret)
                ret = []
        else:
            ret.append(line.rstrip())  # OR  ret.append(line)
    if ret:
        yield ret
1312584
def toDict(self):
        
        d = {}
        nindices = self.getNumIndices()
        for i in range(self.getNumRows()):
            row = list(self.getRowByIndex(i))
            if nindices > 1:
                key = tuple(row[:nindices])
            elif nindices == 1:
                key = row[0]
            else:
                key = None
            if len(row) - nindices == 0:
                d[key] = None
            elif len(row) - nindices == 1:
                d[key] = row[nindices]
            else:
                d[key] = tuple(row[nindices:])
        return d
1264560
def funding_info(self, key, value):
    """"""
    return {
        'agency': value.get('a'),
        'grant_number': value.get('c'),
        'project_number': value.get('f'),
    }
882115
def get(self, *keys, fallback=None):
        

        section, *keys = keys
        out = super().get(section, fallback)

        while isinstance(out, dict):
            key = keys.pop(0)
            out = out.get(key, fallback)

        return out
1033096
def rewrite_elife_funding_awards(json_content, doi):
    

    # remove a funding award
    if doi == "10.7554/eLife.00801":
        for i, award in enumerate(json_content):
            if "id" in award and award["id"] == "par-2":
                del json_content[i]

    # add funding award recipient
    if doi == "10.7554/eLife.04250":
        recipients_for_04250 = [{"type": "person", "name": {"preferred": "Eric Jonas", "index": "Jonas, Eric"}}]
        for i, award in enumerate(json_content):
            if "id" in award and award["id"] in ["par-2", "par-3", "par-4"]:
                if "recipients" not in award:
                    json_content[i]["recipients"] = recipients_for_04250

    # add funding award recipient
    if doi == "10.7554/eLife.06412":
        recipients_for_06412 = [{"type": "person", "name": {"preferred": "Adam J Granger", "index": "Granger, Adam J"}}]
        for i, award in enumerate(json_content):
            if "id" in award and award["id"] == "par-1":
                if "recipients" not in award:
                    json_content[i]["recipients"] = recipients_for_06412

    return json_content
915960
def get_one(self, section, key):
        
        lines = iter(self.get(section, key))
        try:
            return next(lines)
        except StopIteration:
            raise KeyError("Key %s not found in %s" % (key, section))
1337107
def make_article_info_funding(self, article_info_div):
        
        funding_group = self.article.root.xpath('./front/article-meta/funding-group')
        if funding_group:
            funding_div = etree.SubElement(article_info_div,
                                           'div',
                                           {'id': 'funding'})
            funding_b = etree.SubElement(funding_div, 'b')
            funding_b.text = 'Funding: '
            #As far as I can tell, PLoS only uses one funding-statement
            funding_statement = funding_group[0].find('funding-statement')
            append_all_below(funding_div, funding_statement)
553102
async def section(self, sec=None):
        
        if self.writing:
            await dump_varint(self.iobj, len(sec))
            for key in sec:
                await self.section_name(key)
                await self.storage_entry(sec[key])

        else:
            sec = {} if sec is None else sec

            count = await load_varint(self.iobj)
            for idx in range(count):
                sec_name = await self.section_name()
                val = await self.storage_entry()
                sec[sec_name] = val

            return sec
819244
def account(self, id):
        """"""
        if self.parser.has_section(id):
            return self._section_to_account(id)
        return None
635725
def prt_section_key(self, prt=sys.stdout):
        """"""
        for section_name, letter in self.sec2chr.items():
            prt.write("{ABC} {SEC_NAME}\n".format(ABC=letter, SEC_NAME=section_name))
981221
def get_first_part_id_for_assessment(assessment_id, runtime=None, proxy=None, create=False, bank_id=None):
    """"""
    if create and bank_id is None:
        raise NullArgument('Bank Id must be provided for create option')
    try:
        return get_next_part_id(assessment_id, runtime, proxy, sequestered=False)[0]
    except IllegalState:
        if create:
            return create_first_assessment_section(assessment_id, runtime, proxy, bank_id)
        else:
            raise
196090
def _write(self, fp):
        """"""
        def write_section(name, section_dict):
            fp.write(("[%s]\n" % name).encode(defenc))
            for (key, value) in section_dict.items():
                if key != "__name__":
                    fp.write(("\t%s = %s\n" % (key, self._value_to_string(value).replace('\n', '\n\t'))).encode(defenc))
                # END if key is not __name__
        # END section writing

        if self._defaults:
            write_section(cp.DEFAULTSECT, self._defaults)
        for name, value in self._sections.items():
            write_section(name, value)
314917
def segment_common_items(segment_id):
    
    df = data.common_items
    return (
        df
        .loc[str(segment_id)]
        .reset_index(drop=1)
        .drop(columns=["itemOccurrences"])
    )