import re
from datetime import datetime


def parse_ref_date(line):
    """
    This function parses ref_date string format into date time
    format.

    :param line: line containing reference date
    :type line: str
    :returns: reference date in date time format.
    """
    if re.match(r'Ref_date:(.*)', line, re.M | re.I):
        keypair = line.strip('#\n').split(':')
        ref_date = datetime.strptime(keypair[1].strip(), "%d-%b-%Y")
        return ref_date