def get_pos_rng(pos, freq_threshold=0.2):
    """
    Returns a range of possible start/end positions of primers based on a dict
    containing actual found positions
    Args:
        pos: dict { position: frequency }
        freq_threshold: min. frequency required in order to be in range

    Returns: start, end (1-based?)

    """
    pos = sorted(list(pos.items()), key=lambda x: x[1], reverse=True)
    best_pos, best_count = pos[0]
    outpos = {best_pos}
    for p, count in pos[1:]:
        if count / best_count >= freq_threshold:
            outpos.add(p)
    outpos = sorted(list(outpos))
    return outpos[0], outpos[-1]