def METHOD_NAME(args):
    """
    Handles the command line arguments
    args is the list of arguments passed
    return (int): value to return to the OS as program exit code
    """
    # arguments handling
    parser = argparse.ArgumentParser(description="Automated EM/FM acquisitions")
    parser.add_argument("--number", "-n", dest="num", type=int,
                        help="number of acquisitions")
    parser.add_argument("--period", "-p", dest="period", type=float, required=True,
                        help="time between 2 acquisition")
    parser.add_argument("--output", "-o", dest="filename", required=True,
                        help="pattern of the file name output, including the extension (ex: acq-.tiff)")
    options = parser.parse_args(args[1:])
    try:
        if "." not in options.filename[-5:]:
            raise ValueError("output argument must contain extension, but got '%s'" % (options.filename,))
        n = acquire_timelapse(options.num, options.period, options.filename)
    except Exception:
        logging.exception("Unexpected error while performing action.")
        return 127
    return 0