#NEWLINE# def seek( self , offset , whence = os . SEEK_SET ) : #NEWLINE# #INDENT# 'Seeks an offset within the file-like object.\n\n    Args:\n      offset: The offset to seek.\n      whence: Optional value that indicates whether offset is an absolute\n              or relative position within the file.\n\n    Raises:\n      IOError: if the seek failed.\n    ' #NEWLINE# if ( not self . _database_object ) : #NEWLINE# #INDENT# raise IOError ( 'Not opened.' ) #NEWLINE# #UNINDENT# if ( whence == os . SEEK_CUR ) : #NEWLINE# #INDENT# offset += self . _current_offset #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( whence == os . SEEK_END ) : #NEWLINE# #INDENT# offset += self . _size #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( whence != os . SEEK_SET ) : #NEWLINE# #INDENT# raise IOError ( 'Unsupported whence.' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( offset < 0 ) : #NEWLINE# #INDENT# raise IOError ( 'Invalid offset value out of bounds.' ) #NEWLINE# #UNINDENT# self . _current_offset = offset