def METHOD_NAME(cfg, no_binary_check):
    """Returns list of used binary IDs.
    Arguments:
    - `cfg`: python config used to run the pede job
    - `no_binary_check`: if 'True' a check for file existence is skipped
    """
    cms_process = mps_tools.get_process_object(cfg)
    binaries = cms_process.AlignmentProducer.algoConfig.mergeBinaryFiles
    if no_binary_check:
        used_binaries = binaries
    else:
        # following check works only if 'args.cfg' was run from the same directory:
        used_binaries = [b for b in binaries
                         if os.path.exists(os.path.join(os.path.dirname(cfg), b))]
    used_binaries = [int(re.sub(r"milleBinary(\d+)\.dat", r"\1", b))
                     for b in used_binaries]
    return used_binaries