def main(ctx, **kwargs):
    """
    AWS CloudFormation Template Flip is a tool that converts
    AWS CloudFormation templates between JSON and YAML formats,
    making use of the YAML format's short function syntax where possible.
    """
    in_format = kwargs.pop('in_format')
    out_format = kwargs.pop('out_format') or kwargs.pop('out_flag')
    no_flip = kwargs.pop('no_flip')
    clean = kwargs.pop('clean')
    long_form = kwargs.pop('long')
    input_file = kwargs.pop('input')
    output_file = kwargs.pop('output')

    if not in_format:
        if input_file.name.endswith(".json"):
            in_format = "json"
        elif input_file.name.endswith(".yaml") or input_file.name.endswith(".yml"):
            in_format = "yaml"

    if input_file.name == "<stdin>" and sys.stdin.isatty():
        click.echo(ctx.get_help())
        ctx.exit()

    try:
        output_file.write(flip(
            input_file.read(),
            in_format=in_format,
            out_format=out_format,
            clean_up=clean,
            no_flip=no_flip,
            long_form=long_form
        ))
    except Exception as e:
        raise click.ClickException("{}".format(e))
AWS CloudFormation Template Flip is a tool that converts
    AWS CloudFormation templates between JSON and YAML formats,
    making use of the YAML format's short function syntax where possible.