def METHOD_NAME(
    self,
    scope: str | MutableScope,
    *,
    optional: bool | None = None,
) -> MutableScope:
    """
    Add a scope dependency. The dependent scope relationship will be stored in the
    Scope and will be evident in its string representation.
    :param scope: The scope upon which the current scope depends
    :type scope: str
    :param optional: Mark the dependency an optional one. By default it is not. An
        optional scope dependency can be declined by the user without declining
        consent for the primary scope
    :type optional: bool, optional
    """
    if optional is not None:
        if isinstance(scope, MutableScope):
            raise ValueError(
                "cannot use optional=... with a MutableScope object as the "
                "argument to add_dependency"
            )
        warnings.warn(
            "Passing 'optional' to add_dependency is deprecated. "
            "Construct an optional MutableScope object instead.",
            DeprecationWarning,
            stacklevel=2,
        )
        scopeobj = MutableScope(scope, optional=optional)
    else:
        if isinstance(scope, str):
            scopeobj = MutableScope(scope)
        else:
            scopeobj = scope
    self.dependencies.append(scopeobj)
    return self