def METHOD_NAME(self, counter, key=None, pin=None):
    """
    calculate an otp value from counter/time, key and pin
    :param counter:    counter/time to be checked
    :param key:        the secret key
    :param pin:        the secret pin
    :return:           the otp value
    :rtype:            string
    """
    # ref impl from https://github.com/szimszon/motpy/blob/master/motpy
    if pin is None:
        pin = self.pin
    if key is None:
        key = self.key
    vhash = b"%d%b%b" % (counter, key, pin)
    motp = md5(vhash).hexdigest()[: self.digits]
    return motp