code: def _memory_usage(func, gallery_conf):
      
      if gallery_conf['show_memory']:
          from memory_profiler import memory_usage
          assert callable(func)
          mem, out = memory_usage(func, max_usage=True, retval=True,
                                  multiprocess=True)
          mem = mem[0]
      else:
          out = func()
          mem = 0
      return out, mem
docs: Get memory usage of a function call.