def rotate(compound, theta, around):
    """Rotate a compound around an arbitrary vector.

    Parameters
    ----------
    compound : mb.Compound
        The compound being rotated.
    theta : float
        The angle by which to rotate the compound, in radians.
    around : np.ndarray, shape=(3,), dtype=float
        The vector about which to rotate the compound.

    """
    around = np.asarray(around).reshape(3)
    if np.array_equal(around, np.zeros(3)):
        raise ValueError('Cannot rotate around a zero vector')
    atom_positions = compound.xyz_with_ports
    atom_positions = Rotation(theta, around).apply_to(atom_positions)
    compound.xyz_with_ports = atom_positions