#!/usr/bin/python3
# -*- coding: utf-8 -*-

def convert_arg_line_to_args(arg_line):
    """argparse helper for splitting input from config

    Allows comment lines in configfiles and allows both argument and
    value on the same line
    """
    if arg_line.strip().startswith('#'):
        return []
    else:
        return arg_line.split()

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import shlex

def convert_arg_line_to_args(arg_line):
    """argparse helper for splitting input from config

    Allows comment lines in configfiles and allows both argument and
    value on the same line
    """
    return shlex.split(arg_line, comments=True)

Improve config argument splitting to allow quoted spaces