def get_shortest_path_to_object_type(controller, object_type,
    initial_position, initial_rotation=None):
    """
    Computes the shortest path to an object from an initial position using a controller
    :param controller: agent controller
    :param object_type: string that represents the type of the object
    :param initial_position: dict(x=float, y=float, z=float) with the desired initial rotation
    :param initial_rotation: dict(x=float, y=float, z=float) representing rotation around axes or None
    """
    args = dict(action='GetShortestPath', objectType=object_type, position=
        initial_position)
    if initial_rotation is not None:
        args['rotation'] = initial_rotation
    event = controller.step(args)
    if event.metadata['lastActionSuccess']:
        return event.metadata['actionReturn']['corners']
    else:
        print(event.metadata['errorMessage'])
        raise ValueError("Unable to find shortest path for object type '{}'"
            .format(object_type))
