def _compute_action():
    global ACTION
    if ACTION:
        return
    if (FLAG in sys.argv):
        raise ValueError(('%s needs an argument (one of %s)' % (FLAG, ', '.join(CHOICES))))
    if (V4_FLAG in sys.argv):
        ACTION = 'fail'
    d = [i for (i, v) in enumerate(sys.argv) if v.startswith((FLAG + '='))]
    if (len(d) > 1):
        raise ValueError(('Only one %s argument can be used' % FLAG))
    if (not d):
        ACTION = os.getenv(ENVIRONMENT_VARIABLE, (ACTION or DEFAULT))
    else:
        arg = sys.argv.pop(d[0])
        (_, *rest) = arg.split('=')
        if (len(rest) > 1):
            raise ValueError(('Extra = in flag %s' % arg))
        if (not (rest and rest[0].strip())):
            raise ValueError(('%s needs an argument (one of %s)' % (FLAG, ', '.join(CHOICES))))
        ACTION = rest[0]
    if (ACTION not in CHOICES):
        ACTION = None
        raise ValueError(('Unknown deprecation value (must be one of %s)' % ', '.join(CHOICES)))
def _compute_action():
    global ACTION
    if ACTION:
        return
    if (FLAG in sys.argv):
        raise ValueError(('%s needs an argument (one of %s)' % (FLAG, ', '.join(CHOICES))))
    if (V4_FLAG in sys.argv):
        ACTION = 'fail'
    d = [i for (i, v) in enumerate(sys.argv) if v.startswith((FLAG + '='))]
    if (len(d) > 1):
        raise ValueError(('Only one %s argument can be used' % FLAG))
    if (not d):
        ACTION = os.getenv(ENVIRONMENT_VARIABLE, (ACTION or DEFAULT))
    else:
        arg = sys.argv.pop(d[0])
        (_, *rest) = arg.split('=')
        if (len(rest) > 1):
            raise ValueError(('Extra = in flag %s' % arg))
        if (not (rest and rest[0].strip())):
            raise ValueError(('%s needs an argument (one of %s)' % (FLAG, ', '.join(CHOICES))))
        ACTION = rest[0]
    if (ACTION not in CHOICES):
        ACTION = None
        raise ValueError(('Unknown deprecation value (must be one of %s)' % ', '.join(CHOICES)))