parameters: (memory, ratio=1.0)
docstring: Convert memory in G to memory requirement.
  
      Args:
          memory: Memory size in G.
          ratio: The percent that can be used.
  
      Returns:
          Formatted string of memory size if memory is valid, None otherwise.
docstring_summary: Convert memory in G to memory requirement.
docstring_tokens: Convert memory in G to memory requirement .
function: def mem_format(memory, ratio=1.0):
      """Convert memory in G to memory requirement.
  
      Args:
          memory: Memory size in G.
          ratio: The percent that can be used.
  
      Returns:
          Formatted string of memory size if memory is valid, None otherwise.
      """
      try:
          memory = float(memory)
      except:
          return None
      else:
          return "%dM" % int(ratio * memory * 1024)
function_tokens: def mem_format ( memory , ratio = 1.0 ) : try : memory = float ( memory ) except : return None else : return "%dM" % int ( ratio * memory * 1024 )