# Path: src/apscheduler/exceptions.py
# class DeserializationError(Exception):
#     """Raised when a serializer fails to deserialize the given object."""
# 
# class SerializationError(Exception):
#     """Raised when a serializer fails to serialize the given object."""


import sys
from datetime import date, datetime, tzinfo
from functools import partial
from typing import Any, Callable, overload
from .exceptions import DeserializationError, SerializationError
    from zoneinfo import ZoneInfo
    from backports.zoneinfo import ZoneInfo
        raise SerializationError('Callable has no __qualname__ attribute')
    if '<lambda>' in func.__qualname__:
        raise SerializationError('Cannot create a reference to a lambda')
    if '<locals>' in func.__qualname__:
        raise SerializationError('Cannot create a reference to a nested function')

    return f'{func.__module__}:{func.__qualname__}'


def callable_from_ref(ref: str) -> Callable:
    """
    Return the callable pointed to by ``ref``.

    :raises DeserializationError: if the reference could not be resolved or the looked up object is
        not callable

    """
    if ':' not in ref:
        raise ValueError(f'Invalid reference: {ref}')

    modulename, rest = ref.split(':', 1)
    try:
        obj = __import__(modulename, fromlist=[rest])
    except ImportError:
        raise LookupError(f'Error resolving reference {ref!r}: could not import module')

    try:
        for name in rest.split('.'):
            obj = getattr(obj, name)
    except Exception:

# Path: src/apscheduler/exceptions.py
# class DeserializationError(Exception):
#     """Raised when a serializer fails to deserialize the given object."""
# 
# class SerializationError(Exception):
#     """Raised when a serializer fails to serialize the given object."""


# Path: src/apscheduler/marshalling.py
import sys
from datetime import date, datetime, tzinfo
from functools import partial
from typing import Any, Callable, overload
from .exceptions import DeserializationError, SerializationError
    from zoneinfo import ZoneInfo
    from backports.zoneinfo import ZoneInfo

        raise SerializationError('Callable has no __qualname__ attribute')
    if '<lambda>' in func.__qualname__:
        raise SerializationError('Cannot create a reference to a lambda')
    if '<locals>' in func.__qualname__:
        raise SerializationError('Cannot create a reference to a nested function')

    return f'{func.__module__}:{func.__qualname__}'


def callable_from_ref(ref: str) -> Callable:
    """
    Return the callable pointed to by ``ref``.

    :raises DeserializationError: if the reference could not be resolved or the looked up object is
        not callable

    """
    if ':' not in ref:
        raise ValueError(f'Invalid reference: {ref}')

    modulename, rest = ref.split(':', 1)
    try:
        obj = __import__(modulename, fromlist=[rest])
    except ImportError:
        raise LookupError(f'Error resolving reference {ref!r}: could not import module')

    try:
        for name in rest.split('.'):
            obj = getattr(obj, name)
    except Exception:

        raise DeserializationError(f'Error resolving reference {ref!r}: error looking up object')