def parse_keras_history(history_inp):
    """Convert a Keras/TensorFlow history to a dict.

    Keras/TensorFlow history are incompatible with pickle.
    Keep the data (dict), remove everything else to make it pickable.

    Parameters:
    history_inp (history): Keras/TensorFlow training history

    Returns:
    dict: Keras/TensorFlow training history

   """

    history_out = {}
    history_out['history'] = history_inp.history
    history_out['params'] = history_inp.params
    history_out['epoch'] = history_inp.epoch

    return history_out