import re


def is_valid_password(password):
    """
    Return if a password is valid or not.

    A valid password should have its length greater than 8, contain at least one
    digit, one uppercase letter, one lowercase letter and one special character.
    """

    try:
        is_valid = True
        is_valid &= len(password) >= 8
        is_valid &= re.search(r'\d', password) is not None
        is_valid &= re.search(r'[A-Z]', password) is not None
        is_valid &= re.search(r'[a-z]', password) is not None
        is_valid &= re.search(r'\W?_', password) is not None
        return is_valid
    except TypeError:
        raise TypeError('Password should be string, not %s' % type(password))