def simulate_compartment(compartment, settings={}):
    """
    run a compartment simulation
        Requires:
        - a compartment

    Returns:
        - a timeseries of variables from all ports.
        - if 'return_raw_data' is True, it returns the raw data instead
    """
    timestep = settings.get('timestep', 1)
    total_time = settings.get('total_time', 10)
    return_raw_data = settings.get('return_raw_data', False)
    time = 0
    while time < total_time:
        time += timestep
        compartment.update(timestep)
    if return_raw_data:
        return compartment.emitter.get_data()
    else:
        return compartment.emitter.get_timeseries()
