<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_ip(self, hostonly_interface_number, api_port):
 """ Get the IP from VirtualBox. Due to VirtualBox limitation the only way is to send request each second to a GNS3 endpoint in order to get the list of the interfaces and their IP and after that match it with VirtualBox host only. """

        remaining_try = 300
        while remaining_try > 0:
            json_data = None
            session = aiohttp.ClientSession()
            try:
                resp = None
                resp = yield from session.get('http://127.0.0.1:{}/v2/compute/network/interfaces'.format(api_port))
            except (OSError, aiohttp.ClientError, TimeoutError, asyncio.TimeoutError):
                pass

            if resp:
                if resp.status < 300:
                    try:
                        json_data = yield from resp.json()
                    except ValueError:
                        pass
                resp.close()

            session.close()

            if json_data:
                for interface in json_data:
                    if "name" in interface and interface["name"] == "eth{}".format(hostonly_interface_number - 1):
                        if "ip_address" in interface and len(interface["ip_address"]) > 0:
                            return interface["ip_address"]
            remaining_try -= 1
            yield from asyncio.sleep(1)
        raise GNS3VMError("Could not get the GNS3 VM ip make sure the VM receive an IP from VirtualBox")