'Returns a target ID of floating IP association.
:param instance_id: ID of target VM instance
:param target_list: (optional) a list returned by list_targets().
If specified, looking up is done against the specified list
to save extra API calls to a back-end. Otherwise a target
information is retrieved from a back-end inside the method.'

@profiler.trace
def get_target_id_by_instance(self, instance_id, target_list=None):

    if (target_list is not None):
        targets = [target for target in target_list if (target['instance_id'] == instance_id)]
        if (not targets):
            return None
        return targets[0]['id']
    else:
        ports = self._target_ports_by_instance(instance_id)
        if (not ports):
            return None
        return '{0}_{1}'.format(ports[0].id, ports[0].fixed_ips[0]['ip_address'])
