#NEWLINE# def requirement_is_installed( expr ) : #NEWLINE# #INDENT# '\n    Check whether a requirement is installed.\n\n    :param expr: A requirement specification similar to those used in pip\n                 requirement files (a string).\n    :returns: :data:`True` if the requirement is available (installed),\n              :data:`False` otherwise.\n    ' #NEWLINE# required_dist = next ( parse_requirements ( expr ) ) #NEWLINE# try : #NEWLINE# #INDENT# installed_dist = get_distribution ( required_dist . key ) #NEWLINE# return ( installed_dist in installed_dist ) #NEWLINE# #UNINDENT# except DistributionNotFound : #NEWLINE# #INDENT# return False