def get_block_from_time(self, timestring, error_margin=<NUM_LIT:10>):
known_block = self.get_current_block()['<STR_LIT>']<EOL>known_block_timestamp = self.block_timestamp(known_block)<EOL>timestring_timestamp = parse_time(timestring).timestamp()<EOL>delta = known_block_timestamp - timestring_timestamp<EOL>block_delta = delta / <NUM_LIT:3><EOL>guess_block = known_block - block_delta<EOL>guess_block_timestamp = self.block_timestamp(guess_block)<EOL>error = timestring_timestamp - guess_block_timestamp<EOL>while abs(error) > error_margin:<EOL><INDENT>guess_block += error / <NUM_LIT:3><EOL>guess_block_timestamp = self.block_timestamp(guess_block)<EOL>error = timestring_timestamp - guess_block_timestamp<EOL><DEDENT>return int(guess_block)<EOL>
Estimate block number from given time

            :param str timestring: String representing time
            :param int error_margin: Estimate block number within this interval (in seconds)