<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ingress_address(rid=None, unit=None):
 """ Retrieve the ingress-address from a relation when available. Otherwise, return the private-address. When used on the consuming side of the relation (unit is a remote unit), the ingress-address is the IP address that this unit needs to use to reach the provided service on the remote unit. When used on the providing side of the relation (unit == local_unit()), the ingress-address is the IP address that is advertised to remote units on this relation. Remote units need to use this address to reach the local provided service on this unit. Note that charms may document some other method to use in preference to the ingress_address(), such as an address provided on a different relation attribute or a service discovery mechanism. This allows charms to redirect inbound connections to their peers or different applications such as load balancers. Usage: addresses = [ingress_address(rid=u.rid, unit=u.unit) for u in iter_units_for_relation_name(relation_name)] :param rid: string relation id :param unit: string unit name :side effect: calls relation_get :return: string IP address """

    settings = relation_get(rid=rid, unit=unit)
    return (settings.get('ingress-address') or
            settings.get('private-address'))