import re


def abbreviate(s: str, threshold: int = 7, limit: int = 3) -> str:
    """Abbreviate a string, taking accound of camel case to preserve some legibility"""
    assert isinstance(s, str)

    if len(s) > threshold:
        camel_split = re.compile(r"[A-Z]?[a-z]+|[A-Z]+(?=[A-Z]|$)")
        splitted = camel_split.findall(s)
        return "".join(_[: min([len(_), limit])] for _ in splitted)

    return s