def METHOD_NAME(ctx: Context, expected_branch: Optional[str] = None) -> None:
    """Checks if the current git branch matched the ``expected_branch``,
    which defaults to the ``master`` branch. You can also set this via
    context config item ``master_branch_name``.
    """
    if expected_branch is None:
        master_branch_name = safely_load_config(ctx, "ctx.master_branch_name", "master")
    else:
        master_branch_name = expected_branch
    branch = git(
        ctx, "rev-parse --abbrev-ref HEAD", echo=False, hide=True
    ).stdout.strip()
    if branch != master_branch_name:
        raise WrongBranchError(branch, master_branch_name)