def _normalize_mlengine_job_id(job_id):
<EOL>match = re.search(r'<STR_LIT>', job_id)<EOL>if match and match.start() == <NUM_LIT:0>:<EOL><INDENT>job = '<STR_LIT>'.format(job_id)<EOL><DEDENT>else:<EOL><INDENT>job = job_id<EOL><DEDENT>tracker = <NUM_LIT:0><EOL>cleansed_job_id = '<STR_LIT>'<EOL>for m in re.finditer(r'<STR_LIT>', job):<EOL><INDENT>cleansed_job_id += re.sub(r'<STR_LIT>', '<STR_LIT:_>',<EOL>job[tracker:m.start()])<EOL>cleansed_job_id += job[m.start():m.end()]<EOL>tracker = m.end()<EOL><DEDENT>cleansed_job_id += re.sub(r'<STR_LIT>', '<STR_LIT:_>', job[tracker:])<EOL>return cleansed_job_id<EOL>
Replaces invalid MLEngine job_id characters with '_'.

This also adds a leading 'z' in case job_id starts with an invalid
character.

Args:
    job_id: A job_id str that may have invalid characters.

Returns:
    A valid job_id representation.