def extract_headers(error):
    """
    Extract HTTP headers to include in response.

    """
    try:
        return error.headers
    except AttributeError:
        try:
            return error.get_headers()
        except (AttributeError, TypeError):
            return {}