<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_environments(self, project_key: str) -> dict: """ Retrieve all environments for a given project. Includes name, key, and mobile key. :param project_key: Key for project. :returns: dictionary of environments. """

        try:
            resp = self.client.get_project(project_key)
        except launchdarkly_api.rest.ApiException as ex:
            msg = "Unable to get environments."
            resp = "API response was {0} {1}.".format(ex.status, ex.reason)
            LOG.error("%s %s", msg, resp)
            sys.exit(1)

        envs = []

        for env in resp.environments:
            env = dict(
                key=env.key,
                api_key=env.api_key,
                client_id=env.id
            )
            envs.append(env)

        return envs