def extract_data(data, dim):
    """
    extract dimension 'dim' (center_x, center_y or width) of 'data' into a list
    """

    result = []
    for entry in data:
        if dim == 'center_x':
            result.append(entry.center_x)
        elif dim == 'center_y':
            result.append(entry.center_y)
        elif dim == 'width':
            result.append(entry.width)
    return result