def getChemblLigandByDrugName(drugname, returnSmile=False):
    """
        Returns a SmallMol object of a ligand by its drug name. This molecule is retrieve from Chembl. It is possible to
        return also the smile of the ligand.

        Parameters
        ----------
        drugname: str
            The drug name
        returnSmile: bool
            If True, the smile is returned

        Returns
        -------
        sm: moleculekit.smallmol.smallmol.SmallMol
            The SmallMol object

        smile: str
            The smile

        Example
        -------
        >>> sm = getChemblLigandByDrugName('paracetamol')  # doctest: +SKIP
        >>> sm.numAtoms  # doctest: +SKIP
        20
        >>> sm, smile = getChemblLigandByDrugName('paracetamol', returnSmile=True)  # doctest: +SKIP
        >>> smile  # doctest: +SKIP
        'CC(=O)Nc1ccc(O)cc1'
        """
    from moleculekit.smallmol.smallmol import SmallMol
    try:
        from chembl_webresource_client.new_client import new_client
    except ImportError as e:
        raise ImportError(
            'You need to install the chembl_webresource package to use this function. Try using `conda install -c chembl chembl_webresource_client`.'
            )
    drug = new_client.drug
    results = drug.filter(synonyms__icontains=drugname)
    chembl_id = None
    if len(results) == 0:
        return None
    found = False
    for drug_chembl in results:
        for name in drug_chembl['synonyms']:
            matched = [(True) for na in name.split() if na.lower() ==
                drugname.lower()]
            if sum(matched) != 0:
                found = True
                chembl_id = drug_chembl['molecule_chembl_id']
                break
            if found:
                break
    molecule = new_client.molecule
    molecule_chembl = molecule.get(chembl_id)
    smi = molecule_chembl['molecule_structures']['canonical_smiles']
    sm = SmallMol(smi)
    if returnSmile:
        return sm, smi
    return sm
