def LeadingSpaceToHtmlFormat(in_str):
    """
        Given an input string, replace all leading spaces with the
        html equivalent, "&nbsp;".
    """
    html_space   = "&nbsp;"
    lstripped    = in_str.lstrip()
    num_leading  = len(in_str) - len(lstripped)
    return html_space * num_leading + lstripped