def METHOD_NAME(cls, robot: gtd.Robot,
               base_name: Optional[str] = None,
               joint_range: Optional[Tuple[int, int]] = None):
    """Initialize from a robot.
    Arguments:
        robot: a GTDynamics Robot instance
        base_name: add offset for base link, if given
        joint_range: a range of joint indices (base 0)
    """
    # Get desired joints from robot instance.
    if joint_range is None:
        joint_range = 0, robot.numJoints()
    joints = robot.joints()[joint_range[0]:joint_range[1]]
    # Convert all joints into pose/Jacobian pairs.
    pairs = [cls(joint.pMc(), joint.cScrewAxis()) for joint in joints]
    if base_name is not None:
        # Create offset to first link parent.
        assert joint_range is None or joint_range[0] == 0, \
            "Cannot have base name if first joint is not 0"
        base_link = robot.link(base_name)
        sM0 = base_link.bMcom()
        offset = Chain(sM0, np.zeros((6, 0)))
        pairs = [offset] + pairs
    # Now, let compose do the work!
    return cls.compose(*pairs)