def makearglist(args, kwargs, exarg = None, exkwarg = None):
    """
    Generates argument list for a function
    
    Arguments:
    args = list of names of arguments or None if none
    kwargs = dict of keyword argument names to default values as strings,
                    or None if none
    """
    
    arglist = ""
    
    if args:
        for arg in args:
            arglist += arg + ', '
    
    if kwargs:
        for kw, val in kwargs.items():
            arglist += kw + ' = ' + val + ', '
        
    if exarg:
        arglist += '*'+exarg+', '
        
    if exkwarg:
        arglist += '**'+exkwarg+', '
        
    return arglist[:-2]