<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_funding(award_groups):
 """ Given a funding data, format it """

    if not award_groups:
        return []

    funding_awards = []

    for award_groups_item in award_groups:
        for award_group_id, award_group in iteritems(award_groups_item):
            award = ea.FundingAward()
            award.award_group_id = award_group_id
            if award_group.get('id-type') == "FundRef":
                award.institution_id = award_group.get('id')

            award.institution_name = award_group.get('institution')

            # TODO !!! Check for multiple award_id, if exists
            if award_group.get('award-id'):
                award.add_award_id(award_group.get('award-id'))

            funding_awards.append(award)

    return funding_awards