def METHOD_NAME(etagfile, ctagfile, dirname, files):
    import glob
    # error check for each parameter?
    (status, output) = commands.getstatusoutput('cd '+dirname+';etags -a -o ' +
                                                etagfile+' '+' '.join(files))
    if status:
        raise RuntimeError("Error running etags "+output)
    # run ctags in root directory because ctags need path of each file
    # from root directory
    files = []
    gfiles = glob.glob(os.path.join(dirname, '*'))
    for file in gfiles:
        if file.endswith('.c') or \
                file.endswith('.cc') or \
                file.endswith('.icc') or \
                file.endswith('.cxx') or \
                file.endswith('.cpp') or \
                file.endswith('.F') or \
                file.endswith('.F90'):
            files.append(file)
    if files:
        (status, output) = commands.getstatusoutput('ctags -a -f '+ctagfile +
                                                    ' '+' '.join(files))
        if status:
            raise RuntimeError("Error running ctags "+output)
    return