def format_state(state, t, fixed_nodes, perturbations):
    """
    Format network state for output by marking perturbations and fixed nodes.

    :param state: state to format
    :param t: time step at which perturbations and fixed nodes are to be marked
    :param fixed_nodes: dict (by node) of fixed node states
    :param perturbations: dict (by time step) of dicts (by node) of node states
    :return: formatted state with perturbations and fixed nodes marked
    """
    formatted_state = [str(int(node_state)) for node_state in state]

    for node in fixed_nodes:
        formatted_state[node] += '_'

    for node in perturbations.get(t, []):
        formatted_state[node] += "*"

    return formatted_state