def delete_scalar(a_dict, key):
    """Delete a scalar in a ConfigObj object.

    Returns: 0 if nothing was done.
             1 if the scalar was deleted
    """

    if key not in a_dict.scalars:
        return 0

    del a_dict[key]
    return 1