import re


def ReplaceHTMLEntitiesInText(Text):
    """Check and replace the followng HTML entities to their respective code
    for display in a browser: < (less than), > (greater than), & (ampersand),
    " (double quote),  and ' (single quote).

    Arguments:
        Text (str): Text value.

    Returns:
        str : Modifed text value.

    """

    if re.search("""(<|>|&|"|')""", Text):
        return Text.replace("<", "&lt;").replace(">", "&gt;").replace("&", "&amp;").replace('"', "&quot;").replace("'","&apos;")
    else:
        return Text