import inspect


def add_argument_kwargs(params, arg):
    """
    Build kwargs for parser.add_argument function
    """
    valid_hints = [int, float, str, bool]

    fn_default = params[arg].default
    fn_annotation = params[arg].annotation

    # special case, bool with default value becomes a flag
    if fn_annotation is bool and fn_default is not inspect._empty:
        kwargs = {'action': 'store_true' if not fn_default else 'store_false'}
    elif fn_annotation in valid_hints:
        kwargs = {'type': fn_annotation, 'default': fn_default}
    else:
        kwargs = {'default': fn_default}

    return kwargs