Validates a response from a Palo Alto device. Used to verify success of commands.

def _validate_response(response):
    '''
    Validates a response from a Palo Alto device. Used to verify success of commands.

    '''
    if not response:
        return False, 'Unable to validate response from device.'
    elif 'msg' in response:
        if 'line' in response['msg']:
            if response['msg']['line'] == 'already at the top':
                return True, response
            elif response['msg']['line'] == 'already at the bottom':
                return True, response
            else:
                return False, response
        elif response['msg'] == 'command succeeded':
            return True, response
        else:
            return False, response
    elif 'status' in response:
        if response['status'] == "success":
            return True, response
        else:
            return False, response
    else:
        return False, response