pip install bleach python import bleach python cleaned_text = bleach.clean(user_input, tags=["p", "a"], attributes={"a": ["href"]})