import torch


def get_best_action(net, obs):
    """
    Return best action for given observation according to the neural network.
    Best action has lower "Q" value since it estimates cumulative cost.
    """
    obs_left = torch.cat([torch.FloatTensor(obs), torch.FloatTensor([0])], 0)
    obs_right = torch.cat([torch.FloatTensor(obs), torch.FloatTensor([1])], 0)
    q_left = net(obs_left)
    q_right = net(obs_right)
    action = 1 if q_left >= q_right else 0

    return action