human
What is a good Python code to replace a phrase with an underscore.
assistant
Here is a Python code to replace a phrase with an underscore

import string

def replace_phrase(text, phrase):
    """ Replace a phrase with underscore in a text.
    """
    return text.replace(phrase, "_")

# Enter the text
text = "This is a text"

# Enter the phrase
phrase = "This is a phrase"

# Calling the function
print((replace_phrase(text, phrase)))

#Example Output
# This is a text

#Remember to inspect code for bugs.