def duplicates(L):
    """
    Return a list of the duplicates occurring in a given list L.

    Args:
        L (list): an input list

    Returns:
        a sorted list (possibly empty) of the elements appearing
        more than once in input list L.

    Examples:
        >>> duplicates([1, 2, 1, 3, 1, 4, 2, 5])
        [1, 2]
    """

    dupes = set()
    seen = set()
    for x in L:
        if x in seen:
            dupes.add(x)
        seen.add(x)
    return sorted(list(dupes))