def safe_pathname(filename: str) -> str:
    """Generate a safe pathname out of the string passed"""
    return "".join(
        [c for c in filename if c.isalpha() or c.isdigit() or c == " "]
    ).rstrip()