def fit(model, training, optimizer, loss_func, n_epochs):
    """trains a network when given features (x) and labels (y).
   """
    for e in range(n_epochs):
        for x, y in training:
            optimizer.zero_grad()
            loss = loss_func(model(x), y)
            loss.backward()
            optimizer.step()
    print('Finished Training')
