import requests
import time


def check_id_permitted(identifier: str, retries: int = 5) -> bool:
    """Check a user provided identifier is permitted

    This ID is expected to be a valid URL

    Parameters
    ----------
    identifier : str
        identifier URL candidate

    Returns
    -------
    bool
        if valid identifier
    """
    _n_attempts = 0

    while _n_attempts < retries:
        try:
            requests.get(identifier).raise_for_status()
            return True
        except (
            requests.exceptions.MissingSchema,
            requests.exceptions.HTTPError,
            requests.exceptions.ConnectionError,
        ):
            _n_attempts += 1
            time.sleep(1)
            continue

    return False