Optionally filters out aliases from standard doc-id list

def _get_filtered_study_ids(shard, include_aliases=False):
    """Optionally filters out aliases from standard doc-id list"""
    from peyotl.phylesystem.helper import DIGIT_PATTERN
    k = shard.get_doc_ids()
    if shard.has_aliases and (not include_aliases):
        x = []
        for i in k:
            if DIGIT_PATTERN.match(i) or ((len(i) > 1) and (i[-2] == '_')):
                pass
            else:
                x.append(i)
        return x