def analyser_args(args, func):
    """
    Helper function to parse commandline arguments related to --analyser flag. Func
    is a runner function defined elsewhere that does the work.
    """
    if args['start_date'] and args['end_date']:
        if args['output'] and not args['master']:
            func(args['output'], date_range=[args['start_date'][0], args[
                'end_date'][0]])
            return
        if args['output'] and args['master']:
            func(args['output'], args['master'][0], date_range=[args[
                'start_date'][0], args['end_date'][0]])
            return
        if args['master'] and not args['output']:
            func(user_provided_master_path=args['master'][0], date_range=[
                args['start_date'][0], args['end_date'][0]])
            return
        else:
            func(date_range=[args['start_date'][0], args['end_date'][0]])
            return
    if args['compare']:
        func(args['compare'][0])
        return
    else:
        if args['output'] and not args['master']:
            func(output_path=args['output'])
            return
        if args['output'] and args['master']:
            func(args['output'], args['master'][0])
            return
        if args['master'] and not args['output']:
            func(user_provided_master_path=args['master'][0])
            return
        else:
            func()
