def run_spec(x12path, specpath, outname=None, meta=False, datameta=False):
    if (meta and datameta):
        raise ValueError('Cannot specify both meta and datameta.')
    if meta:
        args = [x12path, ('-m ' + specpath)]
    elif datameta:
        args = [x12path, ('-d ' + specpath)]
    else:
        args = [x12path, specpath]
    if outname:
        args += [outname]
    return subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
def run_spec(x12path, specpath, outname=None, meta=False, datameta=False):
    if (meta and datameta):
        raise ValueError('Cannot specify both meta and datameta.')
    if meta:
        args = [x12path, ('-m ' + specpath)]
    elif datameta:
        args = [x12path, ('-d ' + specpath)]
    else:
        args = [x12path, specpath]
    if outname:
        args += [outname]
    return subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)