@classmethod
def from_two_hertz(cls, apitch, bpitch):
    """Creates a JustInterval from two Hertz values.

        :param apitch: A value in Hertz
        :type apitch: int
        :param bpitch: A value in Hertz
        :type bpitch: int

        :rtype: JustInterval

        **Examples**

        >>> JustInterval.from_two_hertz(220, 440)
        JustInterval(2, 1)
        """
    if isinstance(apitch, int) and isinstance(bpitch, int):
        pass
    else:
        try:
            apitch = apitch.frequency
            bpitch = bpitch.frequency
        except AttributeError:
            msg = 'Arguments must either be integers or '
            msg += 'have a hertz attribute. '
            msg += 'Got: {} and {}'.format(type(apitch), type(bpitch))
            raise ValueError(msg)
    smaller = apitch if apitch <= bpitch else bpitch
    greater = apitch if apitch > bpitch else bpitch
    return cls(greater, smaller)
