def replace_domain(email, old_domain, new_domain):
    if "@" + old_domain in email:
        index = email.index("@" + old_domain)
        new_email = email[:index] + "@" + new_domain
        return new_email
    return email

test = replace_domain('mhshohag.ice@yahoo.com', 'yahoo.com', 'gmail.com')
print(test)
