<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert_to_bytes(mem_str):
 """Convert a memory specification, potentially with M or G, into bytes. """

    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)))