#NEWLINE# def string_output( func , argtypes , offset = ( - 1 ) , str_result = False ) : #NEWLINE# #INDENT# '\n    Generates a ctypes prototype for the given function with the\n    given argument types that returns a string from a GDAL pointer.\n    The `const` flag indicates whether the allocated pointer should \n    be freed via the GDAL library routine VSIFree -- but only applies\n    only when `str_result` is True.\n    ' #NEWLINE# func . argtypes = func #NEWLINE# if str_result : #NEWLINE# #INDENT# func . restype = gdal_char_p #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# func . restype = c_int #NEWLINE# #UNINDENT# def _check_str( result , func , cargs ) : #NEWLINE# #INDENT# return check_string ( result , func , cargs , offset = offset , str_result = str_result ) #NEWLINE# #UNINDENT# func . errcheck = _check_str #NEWLINE# return func