def get_neuron_connections(neuron_id, connections, bidirectional):
    """
    Get the connections for a single neuron
    :param neuron_id: ID of neuron
    :param connections: connection list
    :param bidirectional: Flag determining whether both incoming/outgoing connections are returned
    :return: subset of connections list
    """
    neuron_connections = list()
    for connection in connections:
        if connection[0] == neuron_id or (bidirectional and connection[1] == neuron_id or id == -1):
            neuron_connections.append(connection)
    return neuron_connections