<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_unit_name(dimensions):
 """Build the name of the unit from its dimensions."""

    name = ''

    for unit in dimensions:
        if unit['power'] < 0:
            name += 'per '
        power = abs(unit['power'])
        if power == 1:
            name += unit['base']
        elif power == 2:
            name += 'square ' + unit['base']
        elif power == 3:
            name += 'cubic ' + unit['base']
        elif power > 3:
            name += unit['base'] + ' to the %g' % power
        name += ' '

    name = name.strip()

    logging.debug(u'\tUnit inferred name: %s', name)

    return name