#!/usr/bin/env python

import os
import sys
import time
from getpass import getpass, getuser

def convert_to_seconds(interval):
    interval = interval.split(':')
    s = m = h = 0

    try:
        s = interval[-1]
        m = interval[-2]
        h = interval[-3]
    except IndexError:
        pass

    return int(s) + int(m)*60 + int(h)*60*60


prompt = '[sudo] password for {0}: '.format(getuser())
password = getpass(prompt)

interval = convert_to_seconds(sys.argv[1])
time.sleep(interval)

os.system('echo {0} | sudo -S pm-suspend'.format(password))

d3538e2d4044dbd7318d1f4b92ae7d770d6ec415
<mask token>


def convert_to_seconds(interval):
    interval = interval.split(':')
    s = m = h = 0
    try:
        s = interval[-1]
        m = interval[-2]
        h = interval[-3]
    except IndexError:
        pass
    return int(s) + int(m) * 60 + int(h) * 60 * 60


<mask token>

<mask token>


def convert_to_seconds(interval):
    interval = interval.split(':')
    s = m = h = 0
    try:
        s = interval[-1]
        m = interval[-2]
        h = interval[-3]
    except IndexError:
        pass
    return int(s) + int(m) * 60 + int(h) * 60 * 60


<mask token>
time.sleep(interval)
os.system('echo {0} | sudo -S pm-suspend'.format(password))

<mask token>


def convert_to_seconds(interval):
    interval = interval.split(':')
    s = m = h = 0
    try:
        s = interval[-1]
        m = interval[-2]
        h = interval[-3]
    except IndexError:
        pass
    return int(s) + int(m) * 60 + int(h) * 60 * 60


prompt = '[sudo] password for {0}: '.format(getuser())
password = getpass(prompt)
interval = convert_to_seconds(sys.argv[1])
time.sleep(interval)
os.system('echo {0} | sudo -S pm-suspend'.format(password))

import os
import sys
import time
from getpass import getpass, getuser


def convert_to_seconds(interval):
    interval = interval.split(':')
    s = m = h = 0
    try:
        s = interval[-1]
        m = interval[-2]
        h = interval[-3]
    except IndexError:
        pass
    return int(s) + int(m) * 60 + int(h) * 60 * 60


prompt = '[sudo] password for {0}: '.format(getuser())
password = getpass(prompt)
interval = convert_to_seconds(sys.argv[1])
time.sleep(interval)
os.system('echo {0} | sudo -S pm-suspend'.format(password))

#!/usr/bin/env python

import os
import sys
import time
from getpass import getpass, getuser

def convert_to_seconds(interval):
    interval = interval.split(':')
    s = m = h = 0

    try:
        s = interval[-1]
        m = interval[-2]
        h = interval[-3]
    except IndexError:
        pass

    return int(s) + int(m)*60 + int(h)*60*60


prompt = '[sudo] password for {0}: '.format(getuser())
password = getpass(prompt)

interval = convert_to_seconds(sys.argv[1])
time.sleep(interval)

os.system('echo {0} | sudo -S pm-suspend'.format(password))
