def getConfigFilename(arglist, flag='--conf'):
    """Reads argument list to determine if there is a config file provided.

    Used to work with argparse. If `flag` is present in the input array,
    the next argument is assumed to be the filename for the config file.

    Parameters
    ----------
    arglist : list
        List of all arguments to input function, from either sys.argv or a
        custom list
    flag : str (optional) ('--conf')
        Command-line flag to look for in arglist to signify next element
        is filename for config options

    Returns
    -------
    config_filename : str (None)
        Name of config file if 'flag' is present in arglist, otherwise
        defaults to None
    is_first : bool
        Will be true if `flag` is first element of arglist. Used for method
        to allow required args to be passed from config file.

    """
    config_filename = None
    is_first = False
    if flag in arglist:
        idx = arglist.index(flag)
        config_filename = arglist[idx + 1]
        if idx == 0:
            is_first = True
        return config_filename, is_first
    return None, is_first
