code: def convert_to_bytes(mem_str):
      
      if str(mem_str)[-1].upper().endswith("G"):
          return int(round(float(mem_str[:-1]) * 1024 * 1024))
      elif str(mem_str)[-1].upper().endswith("M"):
          return int(round(float(mem_str[:-1]) * 1024))
      else:
          return int(round(float(mem_str)))
docs: Convert a memory specification, potentially with M or G, into bytes.