def METHOD_NAME(metadata, mdid):
    scalar_ops = metadata.findall('dxl:GPDBScalarOp', ns)
    for scop in scalar_ops:
        op_mdid = scop.get('Mdid')
        if op_mdid == mdid:
            sys.stderr.write(
                "Warning, %s: scalar op %s already exists in file, exiting...\n" % (glob_mdp_name, mdid))
            exit(1)
    casts = metadata.findall('dxl:MDCast', ns)
    for md_cast in casts:
        op_mdid = md_cast.get('Mdid')
        if op_mdid == mdid:
            sys.stderr.write(
                "Warning, %s: cast %s already exists in file, exiting...\n" % (glob_mdp_name, mdid))
            exit(1)
    add_scalar_op(metadata, mdid)