import argparse


def calc_bmi(weight, length):
    """Provided/DONE:
       Calc BMI give a weight in kg and length in cm, return the BMI
       rounded on 2 decimals"""
    bmi = int(weight) / ((int(length) / 100) ** 2)
    return round(bmi, 2)


def create_parser():
    """returns a argparse.ArgumentParser object"""
    parser = argparse.ArgumentParser(description="Calculate your BMI.")
    parser.add_argument("-w", '--weight', metavar='WEIGHT', type=int, help='Your weight in kg', required=True)
    parser.add_argument("-l", '--length', metavar='LENGTH', type=int, help='Your length in cm', required=True)
    return parser


def handle_args(args=None):
    """Provided/DONE:
       Call calc_bmi with provided args object.
       If args are not provided get them from create_parser"""
    if args is None:
        parser = create_parser()
        args = parser.parse_args()

    if args.weight and args.length:
        bmi = calc_bmi(args.weight, args.length)
        print(f'Your BMI is: {bmi}')
    else:
        # could enforce SystemExit in create_parser/add_argument, but argparse
        # docs are not clear how to do it, so raising the exception here manually
        raise SystemExit


if __name__ == '__main__':
    handle_args()

import argparse


def calc_bmi(weight, length):
    """Provided/DONE:
       Calc BMI give a weight in kg and length in cm, return the BMI
       rounded on 2 decimals"""
    bmi = int(weight) / ((int(length) / 100) ** 2)
    return round(bmi, 2)


def create_parser():
    """returns a argparse.ArgumentParser object"""
    parser = argparse.ArgumentParser(description="Calculate your BMI.")
    parser.add_argument("-w", '--weight', metavar='WEIGHT', type=int, help='Your weight in kg', required=True)
    parser.add_argument("-l", '--length', metavar='LENGTH', type=int, help='Your length in cm', required=True)
    return parser


def handle_args(args=None):
    """Provided/DONE:
       Call calc_bmi with provided args object.
       If args are not provided get them from create_parser"""
    if args is None:
        parser = create_parser()
        args = parser.parse_args()

    if args.weight and args.length:
        bmi = calc_bmi(args.weight, args.length)
        print(f'Your BMI is: {bmi}')
    else:
        # could enforce SystemExit in create_parser/add_argument, but argparse
        # docs are not clear how to do it, so raising the exception here manually
        raise SystemExit


if __name__ == '__main__':
    handle_args()

Provided/DONE:        Calc BMI give a weight in kg and length in cm, return the BMI        rounded on 2 decimals returns a argparse.ArgumentParser object Provided/DONE:        Call calc_bmi with provided args object.        If args are not provided get them from create_parser # could enforce SystemExit in create_parser/add_argument, but argparse # docs are not clear how to do it, so raising the exception here manually