def value_length(tokens: list):
    """Calculates string length from given tokens"""
    l = 0
    for token in tokens:
        l += len(token) if isinstance(token, str) else len(token.name)
    return l
