def leading_spaces(line: str) -> int:
    """
    Calculates the number of leading spaces in a string.

    Parameters
    ----------
    line

    Returns
    -------
    int
    """
    return len(line) - len(line.lstrip())