def run_resample(resample, nexus_obj, log):
    """
    Resamples the trees in a nexus

    :param resample: Resample every `resample` trees
    :type resample: Integer

    :param nexus_obj: A `NexusReader` instance
    :type nexus_obj: NexusReader

    :return: A NexusReader instance with the given trees removed.
    """
    new = []
    log.info('Resampling ever %d trees' % resample)
    ignore_count = 0
    for index, tree in enumerate(nexus_obj.trees, 1):
        if index % resample == 0:
            new.append(tree)
        else:
            ignore_count += 1
    log.info('Ignored %d trees' % ignore_count)
    nexus_obj.trees.trees = new
    return nexus_obj
