def fix_usage_balance(eb, year):
    """
    Fixes the energy balances after analysing them. This is done manually.
    """
    if year not in [2012, 2013, 2014]:
        raise ValueError('You cannot edit the balance for year {0}.'.format
            (year))
    missing = {(2012): 10529, (2013): 8995, (2014): 9398}
    fix = missing[year]
    eb.loc[('BY', 'total'), 'hard coal (raw)'] = fix
    dom_retail = eb.loc[('BY', 'domestic and retail'), 'hard coal (raw)']
    eb.loc[('BY', 'industrial'), 'hard coal (raw)'] = fix - dom_retail
    if year == 2013 or year == 2012:
        electricity = {(2012): 9150, (2013): 7095}
        gas = {(2012): -27883, (2013): -13317}
        total = {(2012): -18733, (2013): -6222}
        for row in ['total', 'domestic and retail', 'retail']:
            eb.loc[('BE', row), 'electricity'] += electricity[year]
            eb.loc[('BE', row), 'natural gas'] += gas[year]
            eb.loc[('BE', row), 'total'] += total[year]
    missing = {(2012): 5233, (2013): 4396, (2014): 3048}
    if year == 2012:
        fix = missing[year]
        eb.loc[('ST', 'industrial'), 'other'] += fix / 2
        eb.loc[('ST', 'industrial'), 'hard coal (raw)'] += fix / 2
        dom_retail_hc = eb.loc[('ST', 'domestic and retail'), 'hard coal (raw)'
            ]
        eb.loc[('ST', 'total'), 'other'] += fix / 2
        eb.loc[('ST', 'total'), 'hard coal (raw)'] += fix / 2 + dom_retail_hc
    if year == 2013:
        fix = missing[year]
        eb.loc[('ST', 'industrial'), 'mineral oil products'] += fix / 2
        eb.loc[('ST', 'industrial'), 'hard coal (raw)'] += fix / 2
        dom_retail_hc = eb.loc[('ST', 'domestic and retail'), 'hard coal (raw)'
            ]
        dom_retail_oil = eb.loc[('ST', 'domestic and retail'),
            'mineral oil products']
        eb.loc[('ST', 'total'), 'mineral oil products'
            ] += fix / 2 + dom_retail_oil
        eb.loc[('ST', 'total'), 'hard coal (raw)'] += fix / 2 + dom_retail_hc
    if year == 2014:
        fix = missing[year]
        eb.loc[('ST', 'industrial'), 'mineral oil products'] += fix / 2
        eb.loc[('ST', 'industrial'), 'hard coal (coke)'] += fix / 2
        dom_retail = eb.loc[('ST', 'domestic and retail'),
            'mineral oil products']
        eb.loc[('ST', 'total'), 'mineral oil products'] += fix / 2 + dom_retail
        eb.loc[('ST', 'total'), 'hard coal (coke)'] += fix / 2
    return eb
