from typing import Dict
from typing import Optional


def org_and_count_value_from_sparql_response(sparql_response: Dict) -> Optional[Dict]:
    """Map sparql-response to dict with orgId and count value."""
    org = sparql_response.get("organizationNumber")
    org_value = org.get("value") if org else None
    count = sparql_response.get("count")
    count_value = count.get("value") if count else None

    return (
        {"org": org_value.strip().replace(" ", ""), "count": count_value}
        if org_value and count_value
        else None
    )