import re


def isimei(value):
    """
    Return whether or not given value is an imei.
    If the value is an imei, this function returns ``True``, otherwise ``False``.

    Examples::

        >>> isimei('565464561111118')
        True

        >>> isimei('123456789012341')
        False

    :param value: string to validate imei
    """
    pattern = re.compile(r'^[0-9]{15}$')
    sanitized = re.sub(r'[ -]', '', value)
    if not pattern.match(sanitized):
        return False

    should_double = True
    total_sum = 0
    for digit in reversed(sanitized[:-1]):
        digit_int = int(digit)
        if should_double:
            digit_int = digit_int * 2

        if digit_int >= 10:
            total_sum += (digit_int - 9)
        else:
            total_sum += digit_int
        should_double = not should_double
    if str(10 - (total_sum % 10))[-1] == sanitized[-1]:
        return True
    else:
        return False