def contains_memory(memoryrange, memory):
    """Returns True if the given `memory` is in `memoryrange`, False if not."""
    for field, value in memoryrange.lower.ListFields():
        if getattr(memory, field.name) < value:
            return False
    for field, value in memoryrange.upper.ListFields():
        if getattr(memory, field.name) > value:
            return False
    return True