def escape_space(string: str):
    """
    Returns a copy of `string` with all it's spaces prefixed with "\".
    :param string: str
    :return: str
    """
    if not string or " " not in string:
        return string

    length = len(string)
    if length == 1:
        return r"\ " if string == " " else string

    result = ""
    if string[0] == " ":
        result = "\\"
    for ind in range(length - 1):
        if string[ind] != "\\" and string[ind + 1] == " ":
            result += string[ind] + "\\"
        else:
            result += string[ind]
    result += string[-1]

    return result