def _add_input_output(input_files=None, output_file=None, pipe=True):
    """ Add input and output files to command in the form
    'command input_files > output_file', 'command > output_file',
    'command input_files |', 'command input_files', 'command |' or 'command'
    depending on the given files and the value of pipe

    :param input_files: list of file(s) to read from (None: stdin)
    :param output_file: file to write to (None: pipe or stdout,
                        depending on value of pipe)
    :param pipe: only used if output file is None: True: write to pipe,
                 False: write to stdout
    :return: string with input and output modifiers
    """

    input_files =\
        input_files if isinstance(input_files, (list, tuple)) else [
            input_files]

    cmd = ''
    for input_file in input_files:
        if input_file:
            cmd += ' {}'.format(input_file)

    if output_file:
        cmd += ' > {}'.format(output_file)
    elif pipe:
        cmd += ' | '

    return cmd