import io


def endPos(stream):
    """
    :param stream: File stream
    :return: The end position of given stream
    """

    currPos = stream.tell()
    stream.seek(0, io.SEEK_END)
    endPos = stream.tell()
    stream.seek(currPos, io.SEEK_SET)
    return endPos