<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def legacy_interact(self, client, location, visit_url):
        '''Implement LegacyInteractor.legacy_interact by obtaining
        the discharge macaroon using the client's private key
        '''
        agent = self._find_agent(location)
        # Shallow-copy the client so that we don't unexpectedly side-effect
        # it by changing the key. Another possibility might be to
        # set up agent authentication differently, in such a way that
        # we're sure that client.key is the same as self._auth_info.key.
        client = copy.copy(client)
        client.key = self._auth_info.key
        resp = client.request(
            method='POST',
            url=visit_url,
            json={
                'username': agent.username,
                'public_key': str(self._auth_info.key.public_key),
            },
        )
        if resp.status_code != 200:
            raise httpbakery.InteractionError(
                'cannot acquire agent macaroon from {}: {} (response body: {!r})'.format(visit_url, resp.status_code, resp.text))
        if not resp.json().get('agent_login', False):
            raise httpbakery.InteractionError('agent login failed')