def METHOD_NAME(filename, skip_lines=None, max_lines=None):
    """
    Return command to read a file (which may or may not be gzipped), optionally
    skipping a number of leading and trailing lines
    """
    # The `--force` flag means that non-gzipped files are handled transparently
    # as if the command was just `cat`
    command = "gzip --decompress --force --to-stdout --quiet {}".format(quote(filename))
    if skip_lines is not None:
        command += " | tail -n +{}".format(int(skip_lines) + 1)
    if max_lines is not None:
        command += " | head -n {}".format(int(max_lines))
    return command