def gm_get(state, b1, b2):
    """
    If goal is ('pos',b1,b2='hand') and b is clear and we're holding nothing
    Generate either a pickup or an unstack subtask for b1.
    """
    if b2 == 'hand' and state.clear[b1] and state.holding['hand'] == False:
        if state.pos[b1] == 'table':
            return [('a_pickup', b1)]
        else:
            return [('a_unstack', b1, state.pos[b1])]