import re


def clean(text, scrub=None):
    """Clean text to prepare it for comparison.

    Remove text matching `scrub`, and leading whitespace. Convert backslashes
    to forward slashes.

    """
    if scrub:
        text = re.sub(scrub, "", text)
    text = re.sub(r"(?m)^\s+", "", text)
    text = re.sub(r"\\", "/", text)
    return text