def parse_memory_string(self, memory):
        """
        Returns memory in number of bytes (e.g., "228Ki" => 228000)
        """
        if len(memory) < 2:
            return int(memory)

        is_last_numeric = is_numeric(memory[-1])
        is_penultimate_numeric = is_numeric(memory[-2])
        if is_penultimate_numeric and is_last_numeric:
            # Memory is already in bytes
            return int(memory)
        elif not is_penultimate_numeric and is_last_numeric:
            # Impossible case of alphabetical followed by numeric
            raise ValueError("Memory is malformed")
        elif is_penultimate_numeric and not is_last_numeric:
            # Unimplemented case of single-character suffixes (it is unknown
            # whether metric-server implements this). Currently, memory is handled
            # with power-of-two suffixes (e.g., Ki, Mi, etc.)
            raise NotImplementedError("Single character units are not implemented")
        else:
            return int(memory[:-2]) * MEMORY_UNITS[memory[-2:]]

        Returns memory in number of bytes (e.g., "228Ki" => 228000)
        
powerfulseal/k8s/metrics_server_client.py