def finish_connection(self, conn_or_internal_id, successful, failure_reason=None):
        """Finish a connection attempt

        Args:
            conn_or_internal_id (string, int): Either an integer connection id or a string
                internal_id
            successful (bool): Whether this connection attempt was successful
            failure_reason (string): If this connection attempt failed, an optional reason
                for the failure.
        """

        data = {
            'id': conn_or_internal_id,
            'success': successful,
            'failure_reason': failure_reason
        }

        action = ConnectionAction('finish_connection', data, sync=False)
        self._actions.put(action)