def dms2dd(direction, degrees, minutes, seconds):
    """Converts a latitude or longitude from DMS to decimal degrees notation

    Consider the following coordinate:

        N038.57.38.000
        W009.11.04.000

    >>> from geo_tools import dms2dd
    >>> (dms2dd('N', 38.0, 57.0, 38.0), dms2dd('W', 9.0, 11.0, 4.0))
    (38.96055555555556, -9.184444444444445)

    Args:
        direction   (string): The coordinate hemisphere; 'N', 'E', 'S', or 'W'
        degrees     (float): Degrees deviation
        minutes     (float): Minutes deviation
        seconds     (float): Seconds deviation

    Returns:
        float: the DMS coordinate latitude or longitude in decimal degrees
        notation
    """
    decimal_degrees = float(degrees) + float(minutes) / 60 + float(seconds) / (
        60 * 60)
    direction = direction.upper()
    if direction == 'S' or direction == 'W':
        decimal_degrees *= -1
    return decimal_degrees
