def METHOD_NAME(self, operation_name, contents):
    contents = contents.decode('utf-8')
    regex = rf'.. py:method:: ([a-zA-Z0-9]*\.)*{operation_name}\('
    match = re.search(regex, contents)
    self.assertIsNotNone(match, 'Method is not found in contents')
    start_method_document = match.group()
    start_index = match.start()
    contents = contents[start_index:]
    end_index = contents.find('.. py:method::', len(start_method_document))
    contents = contents[:end_index]
    return contents.encode('utf-8')