def get_balance(addresses, filter=None, api_code=None):
if isinstance(addresses, basestring):<EOL><INDENT>resource = '<STR_LIT>' + addresses<EOL><DEDENT>else:<EOL><INDENT>resource = '<STR_LIT>' + '<STR_LIT:|>'.join(addresses)<EOL><DEDENT>if filter is not None:<EOL><INDENT>if isinstance(filter, FilterType):<EOL><INDENT>resource += '<STR_LIT>' + str(filter.value)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>if api_code is not None:<EOL><INDENT>resource += '<STR_LIT>' + api_code<EOL><DEDENT>response = util.call_api(resource)<EOL>json_response = json.loads(response)<EOL>return {k: Balance(v) for (k, v) in json_response.items()}<EOL>
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`