def METHOD_NAME(dihedrals, indices):
    """Returns dihedrals between atoms at given indices."""
    iset = set(indices)
    dihedrals = [dihedral for dihedral in dihedrals if dihedral[0]
                 in iset and dihedral[1] in iset and dihedral[2] in iset and dihedral[3] in iset]
    if dihedrals:
        newindices = np.zeros(indices.max()+1, int)
        newindices[indices] = np.arange(len(indices))
        return newindices[np.array(dihedrals)]