def check(self, hash_algorithm, offset=<NUM_LIT:0>, length=<NUM_LIT:0>, block_size=<NUM_LIT:0>):
t, msg = self.sftp._request(<EOL>CMD_EXTENDED,<EOL>"<STR_LIT>",<EOL>self.handle,<EOL>hash_algorithm,<EOL>long(offset),<EOL>long(length),<EOL>block_size,<EOL>)<EOL>msg.get_text()  <EOL>msg.get_text()  <EOL>data = msg.get_remainder()<EOL>return data<EOL>
Ask the server for a hash of a section of this file.  This can be used
to verify a successful upload or download, or for various rsync-like
operations.

The file is hashed from ``offset``, for ``length`` bytes.
If ``length`` is 0, the remainder of the file is hashed.  Thus, if both
``offset`` and ``length`` are zero, the entire file is hashed.

Normally, ``block_size`` will be 0 (the default), and this method will
return a byte string representing the requested hash (for example, a
string of length 16 for MD5, or 20 for SHA-1).  If a non-zero
``block_size`` is given, each chunk of the file (from ``offset`` to
``offset + length``) of ``block_size`` bytes is computed as a separate
hash.  The hash results are all concatenated and returned as a single
string.

For example, ``check('sha1', 0, 1024, 512)`` will return a string of
length 40.  The first 20 bytes will be the SHA-1 of the first 512 bytes
of the file, and the last 20 bytes will be the SHA-1 of the next 512
bytes.

:param str hash_algorithm:
    the name of the hash algorithm to use (normally ``"sha1"`` or
    ``"md5"``)
:param offset:
    offset into the file to begin hashing (0 means to start from the
    beginning)
:param length:
    number of bytes to hash (0 means continue to the end of the file)
:param int block_size:
    number of bytes to hash per result (must not be less than 256; 0
    means to compute only one hash of the entire segment)
:return:
    `str` of bytes representing the hash of each block, concatenated
    together

:raises:
    ``IOError`` -- if the server doesn't support the "check-file"
    extension, or possibly doesn't support the hash algorithm requested

.. note:: Many (most?) servers don't support this extension yet.

.. versionadded:: 1.4