def switch(self, value=None):
    if self._ended:
        raise error('Fiber has ended')
    curr = current()
    if (curr._thread_id != self._thread_id):
        raise error('Cannot switch to a fiber on a different thread')
    if (self._cont is None):
        self._cont = _continuation.continulet(self._func)
    try:
        return curr._cont.switch(value=value, to=self._cont)
    finally:
        _tls.current_fiber = curr
def switch(self, value=None):
    if self._ended:
        raise error('Fiber has ended')
    curr = current()
    if (curr._thread_id != self._thread_id):
        raise error('Cannot switch to a fiber on a different thread')
    if (self._cont is None):
        self._cont = _continuation.continulet(self._func)
    try:
        return curr._cont.switch(value=value, to=self._cont)
    finally:
        _tls.current_fiber = curr