from typing import Any


def length(val: Any) -> int:
    """Return length of the variable

    Args:
        val (Any): variable to be checked

    Returns:
        int: length of val
    """
    try:
        return len(val)
    except TypeError:
        return 1