def calib_max_pulse(joint, angle):
    """ Utility for modifying maximum pulse length sent to servos.
    Inputs:
        joint: joint object
        angle: joint angle for which to modify pulse
    Returns: updated pulse value for input angle (int)
    """
    print(f'Current {joint.name} {angle}° pulse: {joint.max_pulse}. '
          'Enter new value, or press "enter" to proceed: ')
    pulse = joint.max_pulse
    while True:
        joint.set_angle(angle)
        new_val = input(': ')
        if not new_val:
            return int(pulse)
        try:
            pulse = new_val
            joint.set_pulses(joint.min_pulse, pulse)
        except (ValueError, TypeError):
            print('Invalid input. Please enter a positive integer.')