def is_analyzable(resource):
    """
    Return True if resource has all the data required for the analysis.
    Return False if any of the essential attributes are missing from the resource.
    :param resource: commoncode.resource.Resource
    """
    license_matches = getattr(resource, "licenses", [])
    has_is_license_text = hasattr(resource, "is_license_text")
    has_is_legal = hasattr(resource, "is_legal")
    has_matched_text = all("matched_text" in match for match in license_matches)

    return has_is_license_text and has_matched_text and has_is_legal