def _finish_connection_action(self, action):
        """Finish a connection attempt

        Args:
            action (ConnectionAction): the action object describing what we are
                connecting to and what the result of the operation was
        """

        success = action.data['success']
        conn_key = action.data['id']

        if self._get_connection_state(conn_key) != self.Connecting:
            print("Invalid finish_connection action on a connection whose state is not Connecting, conn_key=%s" % str(conn_key))
            return

        # Cannot be None since we checked above to make sure it exists
        data = self._get_connection(conn_key)
        callback = data['callback']

        conn_id = data['conn_id']
        int_id = data['int_id']

        if success is False:
            reason = action.data['reason']
            if reason is None:
                reason = "No reason was given"

            del self._connections[conn_id]
            del self._int_connections[int_id]
            callback(conn_id, self.id, False, reason)
        else:
            data['state'] = self.Idle
            data['microstate'] = None
            data['callback'] = None
            callback(conn_id, self.id, True, None)
Finish a connection attempt

        Args:
            action (ConnectionAction): the action object describing what we are
                connecting to and what the result of the operation was