<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_balance(addresses, filter=None, api_code=None):
 """Get balances for each address provided. :param tuple addresses: addresses(xpub or base58) to look up :param FilterType filter: the filter for transactions selection (optional) :param str api_code: Blockchain.info API code (optional) :return: a dictionary of str, :class:`Balance` """


    if isinstance(addresses, basestring):
        resource = 'balance?active=' + addresses
    else:
        resource = 'balance?active=' + '|'.join(addresses)
    if filter is not None:
        if isinstance(filter, FilterType):
            resource += '&filter=' + str(filter.value)
        else:
            raise ValueError('Filter must be of FilterType enum')
    if api_code is not None:
        resource += '&api_code=' + api_code
    response = util.call_api(resource)
    json_response = json.loads(response)

    return {k: Balance(v) for (k, v) in json_response.items()}