def METHOD_NAME(name: Any, parent: Any = None, default_key=None):
    value = None
    if isinstance(name, str):
        try:
            # is key of parent?
            value = parent[name]
        except (KeyError, TypeError, ValueError):
            pass
    else:
        # key = (key, value)?
        try:
            name, value = name
        except (TypeError, ValueError):
            # key = {key: value}?
            try:
                name, value = dict(name).popitem()
            except (TypeError, ValueError, AttributeError, KeyError):
                pass
    if not isinstance(name, str):
        raise ValueError(f'name must be a string')
    if value is None:
        return name, None
    try:
        # noinspection PyUnresolvedReferences
        value.items()
    except AttributeError as e:
        if default_key:
            value = {default_key: value}
        else:
            raise ValueError(f'value of {name!r} must be a dictionary') from e
    return name, value