public function findConfiguredHost($host)
    {
        list($user, $host) = $this->parseHost($host);

        foreach ($this->groups as $group) {
            if ((isset($group['host']) && $group['host'] == $host) ||
                (isset($group['hostname']) && $group['hostname'] == $host)) {
                if (! empty($user)) {
                    // User is not specified in the SSH configuration...
                    if (! isset($group['user'])) {
                        continue;
                    }

                    // User is specified in the SSH configuration but is not the given user....
                    if (isset($group['user']) && $group['user'] != $user) {
                        continue;
                    }
                }

                return $group['host'];
            }
        }
    }