def get_future_state(future):
    """Serialises the state of a concurrent.futures.Future"""
    if future is None:
        return {}
    with future._condition:
        return {'state': future._state, 'result': future._result,
            'exception': future._exception}
