def METHOD_NAME(string, string_format):
    """Get a datetime object from a string in the requested string_format.
        Args:
            string (str): The timestamp in the form of a string.
            string_format (str): A string used for formatting.
        Raises:
           DateTimeTypeConversionError: When datetime.strptime() raises a
              TypeError.
           DateTimeValueConversionError: When datetime.strptime() raises a
              ValueError.
        Returns:
            datetime: A datetime object as requested.
    """
    try:
        result = datetime.strptime(string, string_format)
    except TypeError:
        LOGGER.exception('Unable to create a datetime with %s in '
                         'format %s', string, string_format)
        raise DateTimeTypeConversionError
    except ValueError:
        LOGGER.exception('Unable to create a datetime with %s in '
                         'format %s', string, string_format)
        raise DateTimeValueConversionError
    return result